From a39af5a7dd205e00072d10f140d0f446413936ca Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Sun, 19 Dec 2021 23:00:33 +0900 Subject: [PATCH] Support parameters of container_sync middleware Change-Id: I876c0ab20677976f5ebb54fdd15de0906b6ca323 --- manifests/proxy/container_sync.pp | 21 +++++++++++++++++-- ...sync-middleware-opts-91c555d96826b91d.yaml | 8 +++++++ .../swift_proxy_container_sync_spec.rb | 19 ++++++++++++++++- 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/container_sync-middleware-opts-91c555d96826b91d.yaml diff --git a/manifests/proxy/container_sync.pp b/manifests/proxy/container_sync.pp index df6a37b4..72551355 100644 --- a/manifests/proxy/container_sync.pp +++ b/manifests/proxy/container_sync.pp @@ -1,15 +1,32 @@ # # Configure Swift Container Sync # +# == Parameters +# +# [*allow_full_urls*] +# (Optional) Allow full URL values to be set for new X-Container-Sync-To +# headers. +# Defaults to $::os_service_default +# +# [*current*] +# (Optional) Set this to specify this clusters //realm/cluster as "current" in +# /info. +# Defaults to $::os_service_default +# # == Authors # # Denis Egorenko # -class swift::proxy::container_sync() { +class swift::proxy::container_sync( + $allow_full_urls = $::os_service_default, + $current = $::os_service_default, +) { include swift::deps swift_proxy_config { - 'filter:container_sync/use': value => 'egg:swift#container_sync'; + 'filter:container_sync/use': value => 'egg:swift#container_sync'; + 'filter:container_sync/allow_full_urls': value => $allow_full_urls; + 'filter:container_sync/current': value => $current; } } diff --git a/releasenotes/notes/container_sync-middleware-opts-91c555d96826b91d.yaml b/releasenotes/notes/container_sync-middleware-opts-91c555d96826b91d.yaml new file mode 100644 index 00000000..2d2e97d4 --- /dev/null +++ b/releasenotes/notes/container_sync-middleware-opts-91c555d96826b91d.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The ``swift::proxy::container_sync`` class now supports the following two + parameters of the ``container_sync`` middleware. + + - ``allow_full_urls`` + - ``current`` diff --git a/spec/classes/swift_proxy_container_sync_spec.rb b/spec/classes/swift_proxy_container_sync_spec.rb index a112edd2..70eace90 100644 --- a/spec/classes/swift_proxy_container_sync_spec.rb +++ b/spec/classes/swift_proxy_container_sync_spec.rb @@ -7,7 +7,24 @@ require 'spec_helper' describe 'swift::proxy::container_sync' do shared_examples 'swift::proxy::container_sync' do - it { should contain_swift_proxy_config('filter:container_sync/use').with_value('egg:swift#container_sync') } + context 'when using default parameters' do + it { is_expected.to contain_swift_proxy_config('filter:container_sync/use').with_value('egg:swift#container_sync') } + it { is_expected.to contain_swift_proxy_config('filter:container_sync/allow_full_urls').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:container_sync/current').with_value('') } + end + + context 'when overriding default parameters' do + let :params do + { + :allow_full_urls => true, + :current => '//REALM/CLUSTER', + } + end + + it { is_expected.to contain_swift_proxy_config('filter:container_sync/use').with_value('egg:swift#container_sync') } + it { is_expected.to contain_swift_proxy_config('filter:container_sync/allow_full_urls').with_value(true) } + it { is_expected.to contain_swift_proxy_config('filter:container_sync/current').with_value('//REALM/CLUSTER') } + end end on_supported_os({