From 364abe6647d6e09237be1a9a655c48a43fc563a3 Mon Sep 17 00:00:00 2001 From: Matthew J Black Date: Sat, 16 Jan 2016 04:23:05 -0500 Subject: [PATCH] Added v3 domain env variables The current authfile class does not currently specify domains and if someone is using v3 api, it will fail with messages about a domain not being specified. This change exposes two new parameters to specify domain for project and user that are both defaulted to false. When they're specified they will add two env vars in openrc. Change-Id: I4ed3d440e2171e0220e307363e1b7595127dadc7 Closes-Bug: 1534901 --- manifests/auth_file.pp | 11 +++++++++++ spec/classes/openstack_extras_auth_file_spec.rb | 4 ++++ templates/openrc.erb | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/manifests/auth_file.pp b/manifests/auth_file.pp index ab21a2f..7da0b31 100644 --- a/manifests/auth_file.pp +++ b/manifests/auth_file.pp @@ -68,6 +68,15 @@ # (optional) File path # Defaults to '/root/openrc'. # +# [*project_domain*] +# (optional) Project domain in v3 api. +# Defaults to false +# +# [*user_domain*] +# (optional) User domain in v3 api. +# Defaults to false +# + class openstack_extras::auth_file( $password = undef, $auth_url = 'http://127.0.0.1:5000/v2.0/', @@ -77,6 +86,8 @@ class openstack_extras::auth_file( $tenant_name = 'openstack', $region_name = 'RegionOne', $use_no_cache = true, + $project_domain = false, + $user_domain = false, $cinder_endpoint_type = 'publicURL', $glance_endpoint_type = 'publicURL', $keystone_endpoint_type = 'publicURL', diff --git a/spec/classes/openstack_extras_auth_file_spec.rb b/spec/classes/openstack_extras_auth_file_spec.rb index 343d2fd..e7fa6ad 100644 --- a/spec/classes/openstack_extras_auth_file_spec.rb +++ b/spec/classes/openstack_extras_auth_file_spec.rb @@ -44,6 +44,8 @@ describe 'openstack_extras::auth_file' do :nova_endpoint_type => 'internalURL', :neutron_endpoint_type => 'internalURL', :auth_strategy => 'no_auth', + :user_domain => 'Default', + :project_domain => 'Default' } end @@ -58,6 +60,8 @@ describe 'openstack_extras::auth_file' do 'export OS_AUTH_URL=\'http://127.0.0.2:5000/v2.0/\'', 'export OS_AUTH_STRATEGY=\'no_auth\'', 'export OS_REGION_NAME=\'myregion\'', + 'export OS_PROJECT_DOMAIN_NAME=\'Default\'', + 'export OS_USER_DOMAIN_NAME=\'Default\'', 'export CINDER_ENDPOINT_TYPE=\'internalURL\'', 'export GLANCE_ENDPOINT_TYPE=\'internalURL\'', 'export KEYSTONE_ENDPOINT_TYPE=\'internalURL\'', diff --git a/templates/openrc.erb b/templates/openrc.erb index 9b39f39..964a6c8 100644 --- a/templates/openrc.erb +++ b/templates/openrc.erb @@ -10,6 +10,12 @@ export OS_PASSWORD='<%= @password.gsub(/'/){ %q(\') } %>' export OS_AUTH_URL='<%= @auth_url %>' export OS_AUTH_STRATEGY='<%= @auth_strategy %>' export OS_REGION_NAME='<%= @region_name %>' +<% if @project_domain -%> +export OS_PROJECT_DOMAIN_NAME='<%= @project_domain %>' +<% end -%> +<% if @user_domain -%> +export OS_USER_DOMAIN_NAME='<%= @user_domain %>' +<% end -%> export CINDER_ENDPOINT_TYPE='<%= @cinder_endpoint_type %>' export GLANCE_ENDPOINT_TYPE='<%= @glance_endpoint_type %>' export KEYSTONE_ENDPOINT_TYPE='<%= @keystone_endpoint_type %>'