diff --git a/manifests/backend/multistore/swift.pp b/manifests/backend/multistore/swift.pp index a630cbfd..62780383 100644 --- a/manifests/backend/multistore/swift.pp +++ b/manifests/backend/multistore/swift.pp @@ -30,13 +30,13 @@ # (Optional) The address where the Swift authentication service is listening. # Defaults to 'http://127.0.0.1:5000/v3/' # -# [*swift_store_auth_project_domain_id*] -# (Optional) ID of the domain to which the project belongs. -# Defaults to 'default' +# [*swift_store_auth_project_domain_name*] +# (Optional) Name of the domain to which the project belongs. +# Defaults to 'Default' # -# [*swift_store_auth_user_domain_id*] -# (Optional) ID of the domain to which the user belongs. -# Defaults to 'default' +# [*swift_store_auth_user_domain_name*] +# (Optional) Name of the domain to which the user belongs. +# Defaults to 'Default' # # [*swift_store_container*] # (Optional) Name of single container to store images/name prefix for @@ -109,28 +109,38 @@ # (Optional) The authentication version to be used. # Defaults to undef # +# [*swift_store_auth_project_domain_id*] +# (Optional) ID of the domain to which the project belongs. +# Defaults to undef +# +# [*swift_store_auth_user_domain_id*] +# (Optional) ID of the domain to which the user belongs. +# Defaults to undef +# define glance::backend::multistore::swift( $swift_store_user, $swift_store_key, - $swift_store_auth_address = 'http://127.0.0.1:5000/v3/', - $swift_store_container = $facts['os_service_default'], - $swift_store_auth_project_domain_id = 'default', - $swift_store_auth_user_domain_id = 'default', - $swift_store_large_object_size = $facts['os_service_default'], - $swift_store_large_object_chunk_size = $facts['os_service_default'], - $swift_store_create_container_on_put = $facts['os_service_default'], - $swift_store_endpoint_type = 'internalURL', - $swift_store_service_type = $facts['os_service_default'], - $swift_store_region = $facts['os_service_default'], - $default_swift_reference = 'ref1', - $swift_buffer_on_upload = $facts['os_service_default'], - $swift_upload_buffer_dir = $facts['os_service_default'], - $swift_store_retry_get_count = $facts['os_service_default'], - $store_description = $facts['os_service_default'], - $weight = $facts['os_service_default'], + $swift_store_auth_address = 'http://127.0.0.1:5000/v3/', + $swift_store_container = $facts['os_service_default'], + $swift_store_auth_project_domain_name = 'Default', + $swift_store_auth_user_domain_name = 'Default', + $swift_store_large_object_size = $facts['os_service_default'], + $swift_store_large_object_chunk_size = $facts['os_service_default'], + $swift_store_create_container_on_put = $facts['os_service_default'], + $swift_store_endpoint_type = 'internalURL', + $swift_store_service_type = $facts['os_service_default'], + $swift_store_region = $facts['os_service_default'], + $default_swift_reference = 'ref1', + $swift_buffer_on_upload = $facts['os_service_default'], + $swift_upload_buffer_dir = $facts['os_service_default'], + $swift_store_retry_get_count = $facts['os_service_default'], + $store_description = $facts['os_service_default'], + $weight = $facts['os_service_default'], # DEPRECATED PARAMETERS - $swift_store_config_file = undef, - $swift_store_auth_version = undef, + $swift_store_config_file = undef, + $swift_store_auth_version = undef, + $swift_store_auth_project_domain_id = undef, + $swift_store_auth_user_domain_id = undef, ) { include glance::deps @@ -146,8 +156,14 @@ define glance::backend::multistore::swift( $swift_store_config_file_real = '/etc/glance/glance-swift.conf' } - if $swift_store_auth_version != undef { - warning('The swift_store_auth_version parameter is deprecated') + [ + 'swift_store_auth_version', + 'swift_store_auth_project_domain_id', + 'swift_store_auth_user_domain_id' + ].each |String $dep_opt| { + if getvar($dep_opt) != undef { + warning("The ${dep_opt} parameter is deprecated") + } } glance_api_config { @@ -183,11 +199,13 @@ define glance::backend::multistore::swift( } glance_swift_config { - "${default_swift_reference}/user": value => $swift_store_user; - "${default_swift_reference}/key": value => $swift_store_key, secret => true; - "${default_swift_reference}/auth_address": value => $swift_store_auth_address; - "${default_swift_reference}/auth_version": value => pick($swift_store_auth_version, $facts['os_service_default']); - "${default_swift_reference}/user_domain_id": value => $swift_store_auth_user_domain_id; - "${default_swift_reference}/project_domain_id": value => $swift_store_auth_project_domain_id; + "${default_swift_reference}/user": value => $swift_store_user; + "${default_swift_reference}/key": value => $swift_store_key, secret => true; + "${default_swift_reference}/auth_address": value => $swift_store_auth_address; + "${default_swift_reference}/auth_version": value => pick($swift_store_auth_version, $facts['os_service_default']); + "${default_swift_reference}/user_domain_name": value => $swift_store_auth_user_domain_name; + "${default_swift_reference}/project_domain_name": value => $swift_store_auth_project_domain_name; + "${default_swift_reference}/user_domain_id": value => pick($swift_store_auth_user_domain_id, $facts['os_service_default']); + "${default_swift_reference}/project_domain_id": value => pick($swift_store_auth_project_domain_id, $facts['os_service_default']); } } diff --git a/manifests/backend/swift.pp b/manifests/backend/swift.pp index e75d6a72..bc53c876 100644 --- a/manifests/backend/swift.pp +++ b/manifests/backend/swift.pp @@ -15,13 +15,13 @@ # (Optional) The address where the Swift authentication service is listening. # Defaults to 'http://127.0.0.1:5000/v3/' # -# [*swift_store_auth_project_domain_id*] -# (Optional) ID of the domain to which the project belongs. -# Defaults to 'default' +# [*swift_store_auth_project_domain_name*] +# (Optional) Name of the domain to which the project belongs. +# Defaults to 'Default' # -# [*swift_store_auth_user_domain_id*] -# (Optional) ID of the domain to which the user belongs. -# Defaults to 'default' +# [*swift_store_auth_user_domain_name*] +# (Optional) Name of the domain to which the user belongs. +# Defaults to 'Default' # # [*swift_store_container*] # (Optional) Name of single container to store images/name prefix for @@ -66,22 +66,32 @@ # (Optional) The authentication version to be used. # Defaults to undef # +# [*swift_store_auth_project_domain_id*] +# (Optional) ID of the domain to which the project belongs. +# Defaults to 'default' +# +# [*swift_store_auth_user_domain_id*] +# (Optional) ID of the domain to which the user belongs. +# Defaults to 'default' +# class glance::backend::swift( $swift_store_user, $swift_store_key, - $swift_store_auth_address = 'http://127.0.0.1:5000/v3/', - $swift_store_container = $facts['os_service_default'], - $swift_store_auth_project_domain_id = 'default', - $swift_store_auth_user_domain_id = 'default', - $swift_store_large_object_size = $facts['os_service_default'], - $swift_store_large_object_chunk_size = $facts['os_service_default'], - $swift_store_create_container_on_put = $facts['os_service_default'], - $swift_store_endpoint_type = 'internalURL', - $swift_store_region = $facts['os_service_default'], - $default_swift_reference = 'ref1', - Boolean $multi_store = false, + $swift_store_auth_address = 'http://127.0.0.1:5000/v3/', + $swift_store_container = $facts['os_service_default'], + $swift_store_auth_project_domain_name = 'Default', + $swift_store_auth_user_domain_name = 'Default', + $swift_store_large_object_size = $facts['os_service_default'], + $swift_store_large_object_chunk_size = $facts['os_service_default'], + $swift_store_create_container_on_put = $facts['os_service_default'], + $swift_store_endpoint_type = 'internalURL', + $swift_store_region = $facts['os_service_default'], + $default_swift_reference = 'ref1', + Boolean $multi_store = false, # DEPRECATED PARAMETERS - $swift_store_auth_version = undef + $swift_store_auth_version = undef, + $swift_store_auth_project_domain_id = undef, + $swift_store_auth_user_domain_id = undef, ) { include glance::deps @@ -90,20 +100,22 @@ class glance::backend::swift( warning('glance::backend::swift is deprecated. Use glance::backend::multistore::swift instead.') glance::backend::multistore::swift { 'glance_store': - swift_store_user => $swift_store_user, - swift_store_key => $swift_store_key, - swift_store_auth_address => $swift_store_auth_address, - swift_store_container => $swift_store_container, - swift_store_auth_version => $swift_store_auth_version, - swift_store_auth_project_domain_id => $swift_store_auth_project_domain_id, - swift_store_auth_user_domain_id => $swift_store_auth_user_domain_id, - swift_store_large_object_size => $swift_store_large_object_size, - swift_store_large_object_chunk_size => $swift_store_large_object_chunk_size, - swift_store_create_container_on_put => $swift_store_create_container_on_put, - swift_store_endpoint_type => $swift_store_endpoint_type, - swift_store_region => $swift_store_region, - default_swift_reference => $default_swift_reference, - store_description => undef, + swift_store_user => $swift_store_user, + swift_store_key => $swift_store_key, + swift_store_auth_address => $swift_store_auth_address, + swift_store_container => $swift_store_container, + swift_store_auth_version => $swift_store_auth_version, + swift_store_auth_project_domain_name => $swift_store_auth_project_domain_name, + swift_store_auth_user_domain_name => $swift_store_auth_user_domain_name, + swift_store_auth_project_domain_id => $swift_store_auth_project_domain_id, + swift_store_auth_user_domain_id => $swift_store_auth_user_domain_id, + swift_store_large_object_size => $swift_store_large_object_size, + swift_store_large_object_chunk_size => $swift_store_large_object_chunk_size, + swift_store_create_container_on_put => $swift_store_create_container_on_put, + swift_store_endpoint_type => $swift_store_endpoint_type, + swift_store_region => $swift_store_region, + default_swift_reference => $default_swift_reference, + store_description => undef, } if !$multi_store { diff --git a/releasenotes/notes/swift-use-domain-names-28fdebb653c22274.yaml b/releasenotes/notes/swift-use-domain-names-28fdebb653c22274.yaml new file mode 100644 index 00000000..df37ce41 --- /dev/null +++ b/releasenotes/notes/swift-use-domain-names-28fdebb653c22274.yaml @@ -0,0 +1,18 @@ +--- +features: + - | + The ``glance::backend::swift`` class and + the ``glance::backend::multistore::swift`` defined resource type now + support the following two new parameters. + + - ``swift_store_auth_project_domain_name`` + - ``swift_store_auth_user_domain_name`` + +deprecations: + - | + The following parameters of the ``glance::backend::swift`` class and + the ``glance::backend::multistore::swift`` defined resource type have + been deprecated, in favor of the new project_name parameters. + + - ``swift_store_auth_project_domain_id`` + - ``swift_store_auth_user_domain_id`` diff --git a/spec/classes/glance_backend_swift_spec.rb b/spec/classes/glance_backend_swift_spec.rb index bc0bb97b..335ba275 100644 --- a/spec/classes/glance_backend_swift_spec.rb +++ b/spec/classes/glance_backend_swift_spec.rb @@ -45,27 +45,31 @@ describe 'glance::backend::swift' do is_expected.to contain_glance_swift_config('ref1/user').with_value('user') is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('') is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v3/') - is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('default') - is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('default') + is_expected.to contain_glance_swift_config('ref1/user_domain_name').with_value('Default') + is_expected.to contain_glance_swift_config('ref1/project_domain_name').with_value('Default') + is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('') + is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('') end end describe 'when overriding parameters' do let :params do { - :swift_store_user => 'user2', - :swift_store_key => 'key2', - :swift_store_auth_version => '3', - :swift_store_auth_project_domain_id => 'proj_domain', - :swift_store_auth_user_domain_id => 'user_domain', - :swift_store_large_object_size => '100', - :swift_store_large_object_chunk_size => '50', - :swift_store_auth_address => '127.0.0.2:8080/v1.0/', - :swift_store_container => 'swift', - :swift_store_create_container_on_put => true, - :swift_store_endpoint_type => 'publicURL', - :swift_store_region => 'RegionTwo', - :default_swift_reference => 'swift_creds', + :swift_store_user => 'user2', + :swift_store_key => 'key2', + :swift_store_auth_version => '3', + :swift_store_auth_project_domain_name => 'proj_domain', + :swift_store_auth_user_domain_name => 'user_domain', + :swift_store_auth_project_domain_id => 'proj_domain_id', + :swift_store_auth_user_domain_id => 'user_domain_id', + :swift_store_large_object_size => '100', + :swift_store_large_object_chunk_size => '50', + :swift_store_auth_address => '127.0.0.2:8080/v1.0/', + :swift_store_container => 'swift', + :swift_store_create_container_on_put => true, + :swift_store_endpoint_type => 'publicURL', + :swift_store_region => 'RegionTwo', + :default_swift_reference => 'swift_creds', } end @@ -92,8 +96,10 @@ describe 'glance::backend::swift' do is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2') is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('3') is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/') - is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain') - is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain') + is_expected.to contain_glance_swift_config('swift_creds/user_domain_name').with_value('user_domain') + is_expected.to contain_glance_swift_config('swift_creds/project_domain_name').with_value('proj_domain') + is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain_id') + is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain_id') end end end diff --git a/spec/defines/glance_backend_multistore_swift_spec.rb b/spec/defines/glance_backend_multistore_swift_spec.rb index a14092e3..ee9f98c4 100644 --- a/spec/defines/glance_backend_multistore_swift_spec.rb +++ b/spec/defines/glance_backend_multistore_swift_spec.rb @@ -75,34 +75,38 @@ describe 'glance::backend::multistore::swift' do is_expected.to contain_glance_swift_config('ref1/user').with_value('user') is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('') is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v3/') - is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('default') - is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('default') + is_expected.to contain_glance_swift_config('ref1/user_domain_name').with_value('Default') + is_expected.to contain_glance_swift_config('ref1/project_domain_name').with_value('Default') + is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('') + is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('') end end describe 'when overriding parameters' do let :params do { - :store_description => 'My swift store', - :weight => 0, - :swift_store_user => 'user2', - :swift_store_key => 'key2', - :swift_store_auth_version => '3', - :swift_store_auth_project_domain_id => 'proj_domain', - :swift_store_auth_user_domain_id => 'user_domain', - :swift_store_large_object_size => '100', - :swift_store_large_object_chunk_size => '50', - :swift_store_auth_address => '127.0.0.2:8080/v1.0/', - :swift_store_container => 'swift', - :swift_store_create_container_on_put => true, - :swift_store_endpoint_type => 'publicURL', - :swift_store_service_type => 'object-store', - :swift_store_region => 'RegionTwo', - :swift_store_config_file => '/etc/glance/glance-swift2.conf', - :default_swift_reference => 'swift_creds', - :swift_buffer_on_upload => true, - :swift_upload_buffer_dir => '/var/glance/swift', - :swift_store_retry_get_count => 3, + :store_description => 'My swift store', + :weight => 0, + :swift_store_user => 'user2', + :swift_store_key => 'key2', + :swift_store_auth_version => '3', + :swift_store_auth_project_domain_name => 'proj_domain', + :swift_store_auth_user_domain_name => 'user_domain', + :swift_store_auth_project_domain_id => 'proj_domain_id', + :swift_store_auth_user_domain_id => 'user_domain_id', + :swift_store_large_object_size => '100', + :swift_store_large_object_chunk_size => '50', + :swift_store_auth_address => '127.0.0.2:8080/v1.0/', + :swift_store_container => 'swift', + :swift_store_create_container_on_put => true, + :swift_store_endpoint_type => 'publicURL', + :swift_store_service_type => 'object-store', + :swift_store_region => 'RegionTwo', + :swift_store_config_file => '/etc/glance/glance-swift2.conf', + :default_swift_reference => 'swift_creds', + :swift_buffer_on_upload => true, + :swift_upload_buffer_dir => '/var/glance/swift', + :swift_store_retry_get_count => 3, } end @@ -143,8 +147,10 @@ describe 'glance::backend::multistore::swift' do is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2') is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('3') is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/') - is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain') - is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain') + is_expected.to contain_glance_swift_config('swift_creds/user_domain_name').with_value('user_domain') + is_expected.to contain_glance_swift_config('swift_creds/project_domain_name').with_value('proj_domain') + is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain_id') + is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain_id') end end end