Skip to content

Commit 55a70e7

Browse files
authored
Fix ldap user provider parent_id lookup (#319)
* fix get parent id lookup * fix rubocop lint
1 parent 078b5cc commit 55a70e7

File tree

1 file changed

+4
-8
lines changed
  • lib/puppet/provider/keycloak_ldap_user_provider

1 file changed

+4
-8
lines changed

lib/puppet/provider/keycloak_ldap_user_provider/kcadm.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,15 @@ def self.prefetch(resources)
5858
end
5959

6060
def get_parent_id(realm)
61-
parent_id = nil
62-
output = kcadm('get', 'realms', realm, nil, ['id'])
61+
output = kcadm('get', "realms/#{realm}", nil, nil, ['id'])
6362
Puppet.debug("#{realm} realms: #{output}")
6463
begin
6564
data = JSON.parse(output)
6665
rescue JSON::ParserError
67-
Puppet.debug('Unable to parse output from kcadm get realms')
68-
data = []
69-
end
70-
data.each do |d|
71-
parent_id = d['id']
66+
Puppet.debug("Unable to parse output from kcadm get realms/#{realm}")
67+
data = {}
7268
end
73-
parent_id
69+
data['id']
7470
end
7571

7672
def create

0 commit comments

Comments
 (0)