From bb93e6a3755b39cb2408d299ee3015ebed819b20 Mon Sep 17 00:00:00 2001 From: Thiago da Silva Date: Wed, 23 Aug 2017 18:54:17 -0400 Subject: [PATCH] Update s3api configuration Swift has now merged the swift3 middleware into its own source tree and renamed it to s3api. Use of auth_host, auth_port and auth_protocol configuration options was deprecated in the Newton release in favor of auth_uri Related-Change-Id: I9c61d48e673d513cb4c5cf0c9f8b7d1b894729eb Change-Id: I7f085b0c05f2b8c50e7f94ca1c7f4670660da688 Signed-off-by: Thiago da Silva --- manifests/proxy/s3api.pp | 27 ++++++++++++++++ manifests/proxy/s3token.pp | 32 +++++++++++++------ manifests/proxy/swift3.pp | 2 +- .../notes/s3api-d3fe2afefaaa8e9d.yaml | 16 ++++++++++ spec/classes/swift_proxy_s3api_spec.rb | 15 +++++++++ spec/classes/swift_proxy_s3token_spec.rb | 25 +++++++++------ 6 files changed, 96 insertions(+), 21 deletions(-) create mode 100644 manifests/proxy/s3api.pp create mode 100644 releasenotes/notes/s3api-d3fe2afefaaa8e9d.yaml create mode 100644 spec/classes/swift_proxy_s3api_spec.rb diff --git a/manifests/proxy/s3api.pp b/manifests/proxy/s3api.pp new file mode 100644 index 00000000..466d1385 --- /dev/null +++ b/manifests/proxy/s3api.pp @@ -0,0 +1,27 @@ +# +# Configure swift s3api. +# +# == Dependencies +# +# == Parameters +# +# [*ensure*] +# Enable or not s3api middleware +# Defaults to 'present' +# +# [*auth_pipeline_check*] +# Enable pipeline order check +# Defaults to 'false' +# +class swift::proxy::s3api( + $ensure = 'present', + $auth_pipeline_check = false +) { + + include ::swift::deps + + swift_proxy_config { + 'filter:s3api/use': value => 'egg:swift#s3api'; + 'filter:s3api/auth_pipeline_check': value => $auth_pipeline_check; + } +} diff --git a/manifests/proxy/s3token.pp b/manifests/proxy/s3token.pp index 1a8949eb..6293994b 100644 --- a/manifests/proxy/s3token.pp +++ b/manifests/proxy/s3token.pp @@ -6,15 +6,19 @@ # # [*auth_host*] # (optional) The keystone host -# Defaults to 127.0.0.1 +# Defaults to undef. # # [*auth_port*] # (optional) The Keystone client API port -# Defaults to 5000 +# Defaults to undef. # # [*auth_protocol*] # (optional) http or https -# Defaults to http +# Defaults to undef. +# +# [*auth_uri*] +# (optional) The Keystone server uri +# Defaults to http://127.0.0.1:35357 # # == Dependencies # @@ -29,17 +33,25 @@ # Copyright 2012 eNovance licensing@enovance.com # class swift::proxy::s3token( - $auth_host = '127.0.0.1', - $auth_port = '35357', - $auth_protocol = 'http' + $auth_host = undef, + $auth_port = undef, + $auth_protocol = undef, + $auth_uri = 'http://127.0.0.1:35357' ) { include ::swift::deps + if $auth_host and $auth_port and $auth_protocol { + warning('Use of the auth_host, auth_port, and auth_protocol options have been deprecated in favor of auth_uri.') + $auth_uri_real = "${auth_protocol}://${auth_host}:${auth_port}" + } else { + $auth_uri_real = $auth_uri + } + + + swift_proxy_config { - 'filter:s3token/paste.filter_factory': value => 'keystonemiddleware.s3_token:filter_factory'; - 'filter:s3token/auth_host': value => $auth_host; - 'filter:s3token/auth_port': value => $auth_port; - 'filter:s3token/auth_protocol': value => $auth_protocol; + 'filter:s3token/use': value => 'egg:swift#s3token'; + 'filter:s3token/auth_uri': value => $auth_uri_real; } } diff --git a/manifests/proxy/swift3.pp b/manifests/proxy/swift3.pp index 4f6c666d..b987ae9c 100644 --- a/manifests/proxy/swift3.pp +++ b/manifests/proxy/swift3.pp @@ -6,7 +6,7 @@ # == Parameters # # [*ensure*] -# Enable or not ceilometer fragment +# Enable or not swift3 middleware # Defaults to 'present' # # == Examples diff --git a/releasenotes/notes/s3api-d3fe2afefaaa8e9d.yaml b/releasenotes/notes/s3api-d3fe2afefaaa8e9d.yaml new file mode 100644 index 00000000..20347ec6 --- /dev/null +++ b/releasenotes/notes/s3api-d3fe2afefaaa8e9d.yaml @@ -0,0 +1,16 @@ +--- +prelude: > + Swift has now merged the swift3 middleware into its own source tree and + renamed it to s3api. +features: + - | + The s3api middleware provides S3API support to a Swift cluster. +upgrade: + - | + For previous users of Swift3 middleware, it is a simple change to use + the s3api middleware, no APIs have been changed. Simply substitute in the + new middleware in the pipeline and remember to add the filter. +deprecations: + - | + In s3token middleware, the use of auth_host, auth_port and auth_protocol + have been deprecated in favor of auth_uri diff --git a/spec/classes/swift_proxy_s3api_spec.rb b/spec/classes/swift_proxy_s3api_spec.rb new file mode 100644 index 00000000..46996b62 --- /dev/null +++ b/spec/classes/swift_proxy_s3api_spec.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'swift::proxy::s3api' do + + let :facts do + OSDefaults.get_facts({ + :osfamily => 'Debian', + :operatingsystem => 'Ubuntu', + }) + end + + it { is_expected.to contain_swift_proxy_config('filter:s3api/use').with_value('egg:swift#s3api') } + it { is_expected.to contain_swift_proxy_config('filter:s3api/auth_pipeline_check').with_value('false') } + +end diff --git a/spec/classes/swift_proxy_s3token_spec.rb b/spec/classes/swift_proxy_s3token_spec.rb index deff6899..fd2f435c 100644 --- a/spec/classes/swift_proxy_s3token_spec.rb +++ b/spec/classes/swift_proxy_s3token_spec.rb @@ -7,23 +7,28 @@ describe 'swift::proxy::s3token' do end describe "when using default parameters" do - it { is_expected.to contain_swift_proxy_config('filter:s3token/paste.filter_factory').with_value('keystonemiddleware.s3_token:filter_factory') } - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_port').with_value('35357') } - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_protocol').with_value('http') } - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_host').with_value('127.0.0.1') } + it { is_expected.to contain_swift_proxy_config('filter:s3token/use').with_value('egg:swift#s3token') } + it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://127.0.0.1:35357') } end describe "when overriding default parameters" do let :params do { - :auth_port => 4212, - :auth_protocol => 'https', - :auth_host => '1.2.3.4' + :auth_protocol => 'https', + :auth_host => '192.168.4.2', + :auth_port => '3452' } end - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_port').with_value('4212') } - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_protocol').with_value('https') } - it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_host').with_value('1.2.3.4') } + it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('https://192.168.4.2:3452') } + end + + describe "when overriding default parameters" do + let :params do + { + :auth_uri => 'http://192.168.24.11:35357' + } + end + it { is_expected.to contain_swift_proxy_config('filter:s3token/auth_uri').with_value('http://192.168.24.11:35357') } end end