Tag all Swift packages

Some users wish to override the default package provider by their own.

Tag all packages with the 'openstack' to allow mass resource attributes
override using resource collectors.

Change-Id: Ib0cec660f134e266006f41572cafcc4661ca1e67
Closes-bug: #1391209
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-03-29 17:02:47 +02:00
parent 7ad2a10e1f
commit 9561ffffa2
7 changed files with 47 additions and 14 deletions

View File

@ -17,6 +17,7 @@ class swift::client (
package { 'swiftclient': package { 'swiftclient':
ensure => $ensure, ensure => $ensure,
name => $::swift::params::client_package, name => $::swift::params::client_package,
tag => 'openstack',
} }
} }

View File

@ -39,6 +39,7 @@ class swift(
package { 'swift': package { 'swift':
ensure => $package_ensure, ensure => $package_ensure,
name => $::swift::params::package_name, name => $::swift::params::package_name,
tag => 'openstack',
} }
} }

View File

@ -164,6 +164,7 @@ class swift::proxy(
package { 'swift-proxy': package { 'swift-proxy':
ensure => $package_ensure, ensure => $package_ensure,
name => $::swift::params::proxy_package_name, name => $::swift::params::proxy_package_name,
tag => 'openstack',
} }
concat { '/etc/swift/proxy-server.conf': concat { '/etc/swift/proxy-server.conf':

View File

@ -29,6 +29,7 @@ class swift::proxy::swift3(
package { 'swift-plugin-s3': package { 'swift-plugin-s3':
ensure => $ensure, ensure => $ensure,
name => $::swift::params::swift3, name => $::swift::params::swift3,
tag => 'openstack',
} }
concat::fragment { 'swift_swift3': concat::fragment { 'swift_swift3':

View File

@ -46,6 +46,7 @@ define swift::storage::generic(
# this is a way to dynamically build the variables to lookup # this is a way to dynamically build the variables to lookup
# sorry its so ugly :( # sorry its so ugly :(
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"), name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"),
tag => 'openstack',
before => Service["swift-${name}", "swift-${name}-replicator"], before => Service["swift-${name}", "swift-${name}-replicator"],
} }

View File

@ -1,20 +1,45 @@
require 'spec_helper' require 'spec_helper'
describe 'swift::client' do describe 'swift::client' do
it { is_expected.to contain_package('swiftclient').with(
:ensure => 'present', let :params do
:name => 'python-swiftclient' {}
)}
let :facts do
{:osfamily => 'Debian'}
end end
context 'with params' do
let :params do let :default_params do
{:ensure => 'latest'} { :package_ensure => 'present' }
end
shared_examples_for 'swift client' do
let :p do
default_params.merge(params)
end end
it { is_expected.to contain_package('swiftclient').with(
:ensure => 'latest', it { is_expected.to contain_class('swift::params') }
:name => 'python-swiftclient'
)} 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
end end

View File

@ -46,7 +46,10 @@ describe 'swift::storage::generic' do
let :params do let :params do
param_set param_set
end 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( it { is_expected.to contain_service("swift-#{t}").with(
:ensure => 'running', :ensure => 'running',
:enable => true, :enable => true,