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':
ensure => $ensure,
name => $::swift::params::client_package,
tag => 'openstack',
}
}

View File

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

View File

@ -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':

View File

@ -29,6 +29,7 @@ class swift::proxy::swift3(
package { 'swift-plugin-s3':
ensure => $ensure,
name => $::swift::params::swift3,
tag => 'openstack',
}
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
# sorry its so ugly :(
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"),
tag => 'openstack',
before => Service["swift-${name}", "swift-${name}-replicator"],
}

View File

@ -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'}
end
context 'with params' do
let :params do
{:ensure => 'latest'}
{}
end
it { is_expected.to contain_package('swiftclient').with(
:ensure => 'latest',
:name => 'python-swiftclient'
)}
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_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

View File

@ -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,