Add region support to nova providers
Nova providers did not previously have region support, so things like the host aggregate provider do not work as expected in a multi-region environment. This change mirrors what puppet-neutron's providers do, they use the nova_region_name setting, this uses neutron/region_name. Change-Id: I1d5bddbe977352b0458115ab77b8129311b63453 Closes-Bug: #1517220
This commit is contained in:
@@ -44,8 +44,12 @@ class Puppet::Provider::Nova < Puppet::Provider
|
||||
conf = nova_conf
|
||||
if conf and conf['keystone_authtoken'] and
|
||||
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
|
||||
return Hash[ auth_keys.map \
|
||||
creds = Hash[ auth_keys.map \
|
||||
{ |k| [k, conf['keystone_authtoken'][k].strip] } ]
|
||||
if conf['neutron'] and conf['neutron']['region_name']
|
||||
creds['region_name'] = conf['neutron']['region_name'].strip
|
||||
end
|
||||
return creds
|
||||
else
|
||||
raise(Puppet::Error, "File: #{conf_filename} does not contain all " +
|
||||
"required sections. Nova types will not work if nova is not " +
|
||||
@@ -70,6 +74,9 @@ class Puppet::Provider::Nova < Puppet::Provider
|
||||
:OS_TENANT_NAME => q['admin_tenant_name'],
|
||||
:OS_PASSWORD => q['admin_password']
|
||||
}
|
||||
if q.key?('region_name')
|
||||
authenv[:OS_REGION_NAME] = q['region_name']
|
||||
end
|
||||
begin
|
||||
withenv authenv do
|
||||
nova(args)
|
||||
|
Reference in New Issue
Block a user