From 056e2579bda523b09f230a3042585f4441223346 Mon Sep 17 00:00:00 2001 From: Adam Vinsh Date: Fri, 20 May 2016 17:45:22 -0400 Subject: [PATCH] Add keystone to swift-proxy, use dispersion-report The existing acceptence test configures keystone on the swift node but does not configure the swift service to use keystone. This change adds the neccesary middleware to the proxy node to actually use keystone. Further proof of keystone working is acheived by enabling the swift-dispersion-report class which uploads test objects to swift after first authenticating with keystone. This change also updates the call to keystone used by the dispersion class to an updated format. Change-Id: Ibf97762f9b19c0ccb72178b04a1a86028bab8bcf --- manifests/dispersion.pp | 4 ++-- spec/acceptance/basic_swift_spec.rb | 23 +++++++++++++++-------- spec/classes/swift_dispersion_spec.rb | 4 ++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/manifests/dispersion.pp b/manifests/dispersion.pp index 349fcf61..36e9242b 100644 --- a/manifests/dispersion.pp +++ b/manifests/dispersion.pp @@ -108,8 +108,8 @@ class swift::dispersion ( path => ['/bin', '/usr/bin'], subscribe => File['/etc/swift/dispersion.conf'], timeout => 0, - onlyif => "swift -A ${auth_url} -U ${auth_tenant}:${auth_user} -K ${auth_pass} -V ${auth_version} stat | grep 'Account: '", - unless => "swift -A ${auth_url} -U ${auth_tenant}:${auth_user} -K ${auth_pass} -V ${auth_version} list | grep dispersion_", + onlyif => "swift -A ${auth_url} --os-username ${auth_user} --os-project-name ${auth_tenant} --os-password ${auth_pass} -V ${auth_version} stat | grep 'Account: '", + unless => "swift -A ${auth_url} --os-username ${auth_user} --os-project-name ${auth_tenant} --os-password ${auth_pass} -V ${auth_version} list | grep dispersion_", require => Package['swiftclient'], } diff --git a/spec/acceptance/basic_swift_spec.rb b/spec/acceptance/basic_swift_spec.rb index 50212b76..e49c7971 100644 --- a/spec/acceptance/basic_swift_spec.rb +++ b/spec/acceptance/basic_swift_spec.rb @@ -33,6 +33,7 @@ describe 'basic swift' do } # create xfs partitions on a loopback device and mounts them swift::storage::loopback { '2': + seek => '200000', require => Class['swift'], } # sets up storage nodes which is composed of a single @@ -53,19 +54,20 @@ describe 'basic swift' do } class { '::swift::proxy': proxy_local_net_ip => '127.0.0.1', - pipeline => ['healthcheck', 'cache', 'tempauth', 'dlo', 'proxy-server'], + pipeline => ['healthcheck', 'proxy-logging', 'cache', 'authtoken', 'keystone', 'dlo', 'proxy-server'], account_autocreate => true, require => Class['swift::ringbuilder'], } class { '::swift::proxy::authtoken': admin_password => 'a_big_secret', } + class { '::swift::keystone::dispersion': } -> class { '::swift::dispersion': } class {'::swift::objectexpirer': interval => 600, } class { - [ '::swift::proxy::healthcheck', '::swift::proxy::cache', - '::swift::proxy::tempauth', '::swift::proxy::dlo' ]: + [ '::swift::proxy::healthcheck', '::swift::proxy::proxy_logging', '::swift::proxy::cache', + '::swift::proxy::keystone', '::swift::proxy::dlo' ]: } EOS @@ -114,6 +116,7 @@ describe 'basic swift' do } # create xfs partitions on a loopback device and mounts them swift::storage::loopback { '2': + seek => '200000', require => Class['swift'], } # sets up storage nodes which is composed of a single @@ -127,13 +130,13 @@ describe 'basic swift' do require => Swift::Storage::Loopback[2] , } class { '::swift::storage::account': - service_provider => 'swiftinit', + service_provider => 'swiftinit', } class { '::swift::storage::container': - service_provider => 'swiftinit', + service_provider => 'swiftinit', } class { '::swift::storage::object': - service_provider => 'swiftinit', + service_provider => 'swiftinit', } class { '::swift::ringbuilder': part_power => '18', @@ -143,7 +146,7 @@ describe 'basic swift' do } class { '::swift::proxy': proxy_local_net_ip => '127.0.0.1', - pipeline => ['healthcheck', 'cache', 'tempauth', 'proxy-server'], + pipeline => ['healthcheck', 'proxy-logging', 'cache', 'authtoken', 'keystone', 'dlo', 'proxy-server'], account_autocreate => true, require => Class['swift::ringbuilder'], service_provider => 'swiftinit', @@ -151,11 +154,15 @@ describe 'basic swift' do class { '::swift::proxy::authtoken': admin_password => 'a_big_secret', } + class { '::swift::keystone::dispersion': } -> class { '::swift::dispersion': } class {'::swift::objectexpirer': interval => 600, service_provider => 'swiftinit', } - class { ['::swift::proxy::healthcheck', '::swift::proxy::cache', '::swift::proxy::tempauth']: } + class { + [ '::swift::proxy::healthcheck', '::swift::proxy::proxy_logging', '::swift::proxy::cache', + '::swift::proxy::keystone', '::swift::proxy::dlo' ]: + } EOS # Run one time to catch any errors upgrading to swiftinit service provider diff --git a/spec/classes/swift_dispersion_spec.rb b/spec/classes/swift_dispersion_spec.rb index 27c3b06d..8aaf3e57 100644 --- a/spec/classes/swift_dispersion_spec.rb +++ b/spec/classes/swift_dispersion_spec.rb @@ -65,8 +65,8 @@ describe 'swift::dispersion' do is_expected.to contain_exec('swift-dispersion-populate').with( :path => ['/bin', '/usr/bin'], :subscribe => 'File[/etc/swift/dispersion.conf]', - :onlyif => "swift -A #{p[:auth_url]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '", - :unless => "swift -A #{p[:auth_url]} -U #{p[:auth_tenant]}:#{p[:auth_user]} -K #{p[:auth_pass]} -V #{p[:auth_version]} list | grep dispersion_", + :onlyif => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} stat | grep 'Account: '", + :unless => "swift -A #{p[:auth_url]} --os-username #{p[:auth_user]} --os-project-name #{p[:auth_tenant]} --os-password #{p[:auth_pass]} -V #{p[:auth_version]} list | grep dispersion_", :require => 'Package[swiftclient]' ) end