diff --git a/manifests/client.pp b/manifests/client.pp index 757a7478..088d9731 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -17,6 +17,7 @@ class swift::client ( package { 'swiftclient': ensure => $ensure, name => $::swift::params::client_package, + tag => 'openstack', } } diff --git a/manifests/init.pp b/manifests/init.pp index 2163f3e5..b6595eef 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,6 +39,7 @@ class swift( package { 'swift': ensure => $package_ensure, name => $::swift::params::package_name, + tag => 'openstack', } } diff --git a/manifests/proxy.pp b/manifests/proxy.pp index 503a8d54..fe381d4a 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -164,6 +164,7 @@ class swift::proxy( package { 'swift-proxy': ensure => $package_ensure, name => $::swift::params::proxy_package_name, + tag => 'openstack', } concat { '/etc/swift/proxy-server.conf': diff --git a/manifests/proxy/swift3.pp b/manifests/proxy/swift3.pp index 5eecba4f..dec0e0de 100644 --- a/manifests/proxy/swift3.pp +++ b/manifests/proxy/swift3.pp @@ -29,6 +29,7 @@ class swift::proxy::swift3( package { 'swift-plugin-s3': ensure => $ensure, name => $::swift::params::swift3, + tag => 'openstack', } concat::fragment { 'swift_swift3': diff --git a/manifests/storage/generic.pp b/manifests/storage/generic.pp index 928d52e9..ef43c8fe 100644 --- a/manifests/storage/generic.pp +++ b/manifests/storage/generic.pp @@ -46,6 +46,7 @@ define swift::storage::generic( # this is a way to dynamically build the variables to lookup # sorry its so ugly :( name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"), + tag => 'openstack', before => Service["swift-${name}", "swift-${name}-replicator"], } diff --git a/spec/classes/swift_client_spec.rb b/spec/classes/swift_client_spec.rb index 06e1e68f..b4da0905 100644 --- a/spec/classes/swift_client_spec.rb +++ b/spec/classes/swift_client_spec.rb @@ -1,20 +1,45 @@ require 'spec_helper' describe 'swift::client' do - it { is_expected.to contain_package('swiftclient').with( - :ensure => 'present', - :name => 'python-swiftclient' - )} - let :facts do - {:osfamily => 'Debian'} + + let :params do + {} end - context 'with params' do - let :params do - {:ensure => 'latest'} + + let :default_params do + { :package_ensure => 'present' } + end + + shared_examples_for 'swift client' do + let :p do + default_params.merge(params) end - it { is_expected.to contain_package('swiftclient').with( - :ensure => 'latest', - :name => 'python-swiftclient' - )} + + it { is_expected.to contain_class('swift::params') } + + it 'installs swift client package' do + is_expected.to contain_package('swiftclient').with( + :name => 'python-swiftclient', + :ensure => p[:package_ensure], + :tag => 'openstack' + ) + end + + end + + context 'on Debian platform' do + let :facts do + { :osfamily => 'Debian' } + end + + it_configures 'swift client' + end + + context 'on RedHat platform' do + let :facts do + { :osfamily => 'RedHat' } + end + + it_configures 'swift client' end end diff --git a/spec/defines/swift_storage_generic_spec.rb b/spec/defines/swift_storage_generic_spec.rb index 77992c49..b63e8ed9 100644 --- a/spec/defines/swift_storage_generic_spec.rb +++ b/spec/defines/swift_storage_generic_spec.rb @@ -46,7 +46,10 @@ describe 'swift::storage::generic' do let :params do param_set end - it { is_expected.to contain_package("swift-#{t}").with_ensure(param_hash[:package_ensure]) } + it { is_expected.to contain_package("swift-#{t}").with( + :ensure => param_hash[:package_ensure], + :tag => 'openstack' + )} it { is_expected.to contain_service("swift-#{t}").with( :ensure => 'running', :enable => true,