diff --git a/lib/puppet/provider/cinder.rb b/lib/puppet/provider/cinder.rb index 829a3353..ffb98f02 100644 --- a/lib/puppet/provider/cinder.rb +++ b/lib/puppet/provider/cinder.rb @@ -32,6 +32,10 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack @credentials.password = cinder_credentials['admin_password'] @credentials.project_name = cinder_credentials['admin_tenant_name'] @credentials.auth_url = auth_endpoint + if @credentials.version == '3' + @credentials.user_domain_name = cinder_credentials['user_domain_name'] + @credentials.project_domain_name = cinder_credentials['project_domain_name'] + end raise error unless @credentials.set? Puppet::Provider::Openstack.request(service, action, properties, @credentials) end @@ -52,6 +56,16 @@ class Puppet::Provider::Cinder < Puppet::Provider::Openstack auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?} creds = Hash[ auth_keys.map \ { |k| [k, conf['keystone_authtoken'][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 return creds else raise(Puppet::Error, "File: #{conf_filename} does not contain all " + diff --git a/lib/puppet/provider/cinder_type/openstack.rb b/lib/puppet/provider/cinder_type/openstack.rb index feaea49a..9aa31c5b 100644 --- a/lib/puppet/provider/cinder_type/openstack.rb +++ b/lib/puppet/provider/cinder_type/openstack.rb @@ -7,7 +7,7 @@ Puppet::Type.type(:cinder_type).provide( desc 'Provider for cinder types.' - @credentials = Puppet::Provider::Openstack::CredentialsV2_0.new + @credentials = Puppet::Provider::Openstack::CredentialsV3.new mk_resource_methods diff --git a/releasenotes/notes/keystone-v3-support-cinder_type-09357cfcf7834e80.yaml b/releasenotes/notes/keystone-v3-support-cinder_type-09357cfcf7834e80.yaml new file mode 100644 index 00000000..399cf753 --- /dev/null +++ b/releasenotes/notes/keystone-v3-support-cinder_type-09357cfcf7834e80.yaml @@ -0,0 +1,4 @@ +--- +features: + - Keystone v3 support is added to the cinder_type + provider. diff --git a/spec/unit/provider/cinder_spec.rb b/spec/unit/provider/cinder_spec.rb index cfc88500..246ae58d 100644 --- a/spec/unit/provider/cinder_spec.rb +++ b/spec/unit/provider/cinder_spec.rb @@ -24,10 +24,12 @@ describe Puppet::Provider::Cinder do it 'should read conf file with all sections' do creds_hash = { - 'auth_uri' => 'https://192.168.56.210:35357/v2.0/', - 'admin_tenant_name' => 'admin_tenant', - 'admin_user' => 'admin', - 'admin_password' => 'password', + 'auth_uri' => 'https://192.168.56.210:35357/v2.0/', + 'admin_tenant_name' => 'admin_tenant', + 'admin_user' => 'admin', + 'admin_password' => 'password', + 'project_domain_name' => 'Default', + 'user_domain_name' => 'Default', } mock = { 'keystone_authtoken' => {