Browse Source

Fix wrong key to look up domain parameters from puppet.conf

... and refactor the logic to ensure credentials are picked up from
the correct section.

Closes-Bug: #1941953
Change-Id: Ibbc8aa6f31a3e28978d6d779add8ee9dd0dbd6e4
(cherry picked from commit 9e71c1102f)
(cherry picked from commit 64705ccfbf)
changes/83/820883/1
Takashi Kajinami 9 months ago
parent
commit
68d3021365
  1. 21
      lib/puppet/provider/keystone.rb

21
lib/puppet/provider/keystone.rb

@ -25,26 +25,29 @@ class Puppet::Provider::Keystone < Puppet::Provider::Openstack
end
def self.get_keystone_puppet_credentials
auth_keys = ['auth_url', 'project_name', 'username',
'password']
conf = keystone_puppet_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
creds = Hash[ auth_keys.map \
{ |k| [k, conf['keystone_authtoken'][k].strip] } ]
auth_keys = ['auth_url', 'project_name', 'username', 'password']
conf = keystone_puppet_conf ? keystone_puppet_conf['keystone_authtoken'] : {}
if conf and auth_keys.all?{|k| !conf[k].nil?}
creds = Hash[ auth_keys.map { |k| [k, conf[k].strip] } ]
if conf['project_domain_name']
creds['project_domain_name'] = conf['project_domain_name']
else
creds['project_domain_name'] = 'Default'
end
if conf['user_domain_name']
creds['user_domain_name'] = conf['user_domain_name']
else
creds['user_domain_name'] = 'Default'
end
if conf['keystone_authtoken']['region_name']
creds['region_name'] = conf['keystone_authtoken']['region_name']
if conf['region_name']
creds['region_name'] = conf['region_name']
end
return creds
else
raise(Puppet::Error, "File: #{conf_filename} does not contain all " +

Loading…
Cancel
Save