From 9e48b8be889c4506ba5d784cad82b6e8d7b27a8e Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 14 Jan 2024 02:58:15 +0900 Subject: [PATCH] swift: Improve parameter support coverage Change-Id: I017808988071f4cd52186bc1529d07958867a5fe --- manifests/messaging/swift.pp | 35 ++++++++++++++++--- ...ging-swift-more-opts-a65b6cec28e03d77.yaml | 10 ++++++ spec/classes/zaqar_messaging_swift_spec.rb | 27 +++++++++----- 3 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/zaqar-messaging-swift-more-opts-a65b6cec28e03d77.yaml diff --git a/manifests/messaging/swift.pp b/manifests/messaging/swift.pp index 2c3b6f0..fc69cd1 100644 --- a/manifests/messaging/swift.pp +++ b/manifests/messaging/swift.pp @@ -1,21 +1,46 @@ # == class: zaqar::messaging::swift # # [*uri*] -# Swift Connection URI. Required. +# (Required) Swift Connection URI. # # [*auth_url*] -# URL to the KeyStone service. Default $facts['os_service_default'] +# (Optional) URL to the KeyStone service. +# Default $facts['os_service_default'] +# +# [*project_domain_name*] +# (Optional) Project's domain name. +# Default $facts['os_service_default'] +# +# [*user_domain_name*] +# (Optional) User's domain name. +# Default $facts['os_service_default'] +# +# [*region_name*] +# (Optional) Region name. +# Default $facts['os_service_default'] +# +# [*interface*] +# (Optional) The default interface for endpoint URL discovery. +# Default $facts['os_service_default'] # class zaqar::messaging::swift( $uri, - $auth_url = $facts['os_service_default'], + $auth_url = $facts['os_service_default'], + $project_domain_name = $facts['os_service_default'], + $user_domain_name = $facts['os_service_default'], + $region_name = $facts['os_service_default'], + $interface = $facts['os_service_default'], ) { include zaqar::deps zaqar_config { - 'drivers:message_store:swift/uri': value => $uri, secret => true; - 'drivers:message_store:swift/auth_url': value => $auth_url; + 'drivers:message_store:swift/uri': value => $uri, secret => true; + 'drivers:message_store:swift/auth_url': value => $auth_url; + 'drivers:message_store:swift/project_domain_name': value => $project_domain_name; + 'drivers:message_store:swift/user_domain_name': value => $user_domain_name; + 'drivers:message_store:swift/region_name': value => $region_name; + 'drivers:message_store:swift/interface': value => $interface; } } diff --git a/releasenotes/notes/zaqar-messaging-swift-more-opts-a65b6cec28e03d77.yaml b/releasenotes/notes/zaqar-messaging-swift-more-opts-a65b6cec28e03d77.yaml new file mode 100644 index 0000000..2a59752 --- /dev/null +++ b/releasenotes/notes/zaqar-messaging-swift-more-opts-a65b6cec28e03d77.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + The following parameters have been added to the ``zaqar::messaging::swift`` + class. + + - ``project_domain_name`` + - ``user_domain_name`` + - ``region_name`` + - ``interface`` diff --git a/spec/classes/zaqar_messaging_swift_spec.rb b/spec/classes/zaqar_messaging_swift_spec.rb index 2caddf1..d85360b 100644 --- a/spec/classes/zaqar_messaging_swift_spec.rb +++ b/spec/classes/zaqar_messaging_swift_spec.rb @@ -16,7 +16,7 @@ describe 'zaqar::messaging::swift' do end let :req_params do { - :uri => 'swift://user:pass@/zaqar', + :uri => 'swift://user:pass@/zaqar', } end @@ -26,12 +26,15 @@ describe 'zaqar::messaging::swift' do end it 'should config swift messaging driver' do - is_expected.to contain_zaqar_config('drivers/message_store').with( - :value => 'swift' - ) - is_expected.to contain_zaqar_config('drivers:message_store:swift/uri').with( - :value => 'swift://user:pass@/zaqar', - ) + is_expected.to contain_zaqar_config('drivers/message_store').with_value('swift') + is_expected.to contain_zaqar_config('drivers:message_store:swift/uri').with_value( + 'swift://user:pass@/zaqar', + ).with_secret(true) + is_expected.to contain_zaqar_config('drivers:message_store:swift/auth_url').with_value('') + is_expected.to contain_zaqar_config('drivers:message_store:swift/project_domain_name').with_value('') + is_expected.to contain_zaqar_config('drivers:message_store:swift/user_domain_name').with_value('') + is_expected.to contain_zaqar_config('drivers:message_store:swift/region_name').with_value('') + is_expected.to contain_zaqar_config('drivers:message_store:swift/interface').with_value('') end end @@ -39,12 +42,20 @@ describe 'zaqar::messaging::swift' do describe 'with custom values' do let :params do req_params.merge!({ - :auth_url => 'http://foo', + :auth_url => 'http://foo', + :project_domain_name => 'Domain1', + :user_domain_name => 'Domain2', + :region_name => 'regionOne', + :interface => 'publicURL', }) end it 'configures custom values' do is_expected.to contain_zaqar_config('drivers:message_store:swift/auth_url').with_value('http://foo') + is_expected.to contain_zaqar_config('drivers:message_store:swift/project_domain_name').with_value('Domain1') + is_expected.to contain_zaqar_config('drivers:message_store:swift/user_domain_name').with_value('Domain2') + is_expected.to contain_zaqar_config('drivers:message_store:swift/region_name').with_value('regionOne') + is_expected.to contain_zaqar_config('drivers:message_store:swift/interface').with_value('publicURL') end end end