Fix region support for nova providers

When some of the providers (like nova_aggregate) were moved over to
openstacklib, region support was missing.  This fixes the base provider
code to pass region_name into openstacklib if region_name is set.

Change-Id: I6953c10ceab708402ce25a23d1f8d20f3288cbad
Closes-Bug: #1517220
Depends-On: I3345dac8bebd68f93290c1d45aa9a4d80bf3fb34
This commit is contained in:
Clayton O'Neill 2016-10-03 20:11:25 +00:00
parent 7fd6288cdf
commit a0f2e78d88
3 changed files with 11 additions and 0 deletions

View File

@ -31,6 +31,9 @@ class Puppet::Provider::Nova < Puppet::Provider::Openstack
@credentials.user_domain_name = nova_credentials['user_domain_name']
@credentials.project_domain_name = nova_credentials['project_domain_name']
end
if nova_credentials['region_name']
@credentials.region_name = nova_credentials['region_name']
end
raise error unless @credentials.set?
Puppet::Provider::Openstack.request(service, action, properties, @credentials)
end

View File

@ -0,0 +1,6 @@
---
fixes:
- When some of the nova providers (such as nova_aggregate) were switched over
to use the shared provider code in puppet-openstacklib, region support was
inadvertently dropped. This restores support for regions for all
providers.

View File

@ -15,6 +15,7 @@ describe Puppet::Provider::Nova do
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'region_name' => 'Region1',
}
end
@ -72,6 +73,7 @@ describe Puppet::Provider::Nova do
:OS_USERNAME => credential_hash['username'],
:OS_PROJECT_NAME => credential_hash['project_name'],
:OS_PASSWORD => credential_hash['password'],
:OS_REGION_NAME => credential_hash['region_name'],
}
klass.expects(:get_nova_credentials).with().returns(credential_hash)
klass.expects(:withenv).with(authenv)