Add region support to credentials

This fixes the credentials classes to properly accept region as a
property to manage.  This allows OS_REGION_NAME to be set properly if
the child class passes it in.

Change-Id: I3345dac8bebd68f93290c1d45aa9a4d80bf3fb34
Partial-Bug: #1517220
This commit is contained in:
Clayton O'Neill 2016-10-03 19:58:26 +00:00
parent c6644f3162
commit f705fd6f4d
3 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,8 @@ class Puppet::Provider::Openstack::Credentials
KEYS = [
:auth_url, :password, :project_name, :username,
:token, :url,
:identity_api_version
:identity_api_version,
:region_name
]
KEYS.each { |var| attr_accessor var }

View File

@ -0,0 +1,4 @@
---
fixes:
- Add support for multiple regions in base provider code used by other puppet
modules.

View File

@ -114,6 +114,7 @@ describe Puppet::Provider::Openstack::Credentials do
creds.token = 'token'
creds.url = 'url'
creds.identity_api_version = 'identity_api_version'
creds.region_name = 'Region1'
expect(creds.to_env).to eq({
'OS_USERNAME' => 'username',
'OS_PASSWORD' => 'password',
@ -121,7 +122,8 @@ describe Puppet::Provider::Openstack::Credentials do
'OS_AUTH_URL' => 'auth_url',
'OS_TOKEN' => 'token',
'OS_URL' => 'url',
'OS_IDENTITY_API_VERSION' => 'identity_api_version'
'OS_IDENTITY_API_VERSION' => 'identity_api_version',
'OS_REGION_NAME' => 'Region1',
})
end
end