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