From e4723c8281c92597a72226940d75ff6edfe2c313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simen=20Andr=C3=A8=20Vikestrand=20Skogum?= Date: Wed, 16 Oct 2024 12:39:06 +0200 Subject: [PATCH] fix: testing fix --- libraries/ldap_config_file.rb | 4 ++-- resources/config_ldap_group_mapping.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/ldap_config_file.rb b/libraries/ldap_config_file.rb index 13f56cf7..c3dbb45f 100644 --- a/libraries/ldap_config_file.rb +++ b/libraries/ldap_config_file.rb @@ -77,12 +77,12 @@ def load_file_ldap_config_host_attributes(config_file, host) # @param group_dn [String] The group DN to return configuration for # @return [Hash] Host attribute configuration # - def load_file_ldap_config_host_group_mapping(config_file, host, group_dn) + def load_file_ldap_config_host_group_mapping(config_file, host, org_role) host_config = load_file_ldap_config_host(config_file, host) return if nil_or_empty?(host_config) - group_mapping = host_config.fetch('group_mappings', []).select { |gm| gm['group_dn'].eql?(group_dn) }.first + group_mapping = host_config.fetch('group_mappings', []).select { |gm| gm['org_role'].eql?(org_role) }.first Chef::Log.debug("load_file_ldap_config_host_group_mapping: #{config_file} host #{host} group #{group_dn} - [#{group_mapping.class}] #{group_mapping}") group_mapping diff --git a/resources/config_ldap_group_mapping.rb b/resources/config_ldap_group_mapping.rb index 0322e2fd..89abf533 100644 --- a/resources/config_ldap_group_mapping.rb +++ b/resources/config_ldap_group_mapping.rb @@ -39,7 +39,7 @@ property :org_id, Integer load_current_value do |new_resource| - current_config = load_file_ldap_config_host_group_mapping(new_resource.config_file, new_resource.host, new_resource.group_dn) + current_config = load_file_ldap_config_host_group_mapping(new_resource.config_file, new_resource.host, new_resource.org_role) current_value_does_not_exist! unless current_config