From 55a70e7e88dfbc939682fca9294a41ddb0917a85 Mon Sep 17 00:00:00 2001 From: aba-zwicker <161852763+aba-zwicker@users.noreply.github.com> Date: Sat, 19 Oct 2024 17:28:39 +0200 Subject: [PATCH] Fix ldap user provider parent_id lookup (#319) * fix get parent id lookup * fix rubocop lint --- .../provider/keycloak_ldap_user_provider/kcadm.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/puppet/provider/keycloak_ldap_user_provider/kcadm.rb b/lib/puppet/provider/keycloak_ldap_user_provider/kcadm.rb index 960f5c1a..e89923f2 100644 --- a/lib/puppet/provider/keycloak_ldap_user_provider/kcadm.rb +++ b/lib/puppet/provider/keycloak_ldap_user_provider/kcadm.rb @@ -58,19 +58,15 @@ def self.prefetch(resources) end def get_parent_id(realm) - parent_id = nil - output = kcadm('get', 'realms', realm, nil, ['id']) + output = kcadm('get', "realms/#{realm}", nil, nil, ['id']) Puppet.debug("#{realm} realms: #{output}") begin data = JSON.parse(output) rescue JSON::ParserError - Puppet.debug('Unable to parse output from kcadm get realms') - data = [] - end - data.each do |d| - parent_id = d['id'] + Puppet.debug("Unable to parse output from kcadm get realms/#{realm}") + data = {} end - parent_id + data['id'] end def create