Add client_package_ensure parameter and swift::client class
In the actual state of the manifest we can only setup package_ensure to absent|present|latest. This commit allow end users to pin swift* and swift-client to a specific version. (note that swift* and python-swiftclient version are not the same). A new class (swift::client) manage now client packages, and we keep the retro-compatibility of commit 020b7723cbbe75fbcae89514a1e1882ae807fb27. Change-Id: I9bcc5a0f9d0a93a812fb574c4571fb9584077e4a
This commit is contained in:
parent
2cce66ef44
commit
21f9eff35c
20
manifests/client.pp
Normal file
20
manifests/client.pp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# == Class: swift::client
|
||||||
|
#
|
||||||
|
# Installs swift client.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*ensure*]
|
||||||
|
# (optional) Ensure state of the package.
|
||||||
|
# Defaults to 'present'.
|
||||||
|
#
|
||||||
|
class swift::client (
|
||||||
|
$ensure = 'present'
|
||||||
|
) {
|
||||||
|
|
||||||
|
package { 'swiftclient':
|
||||||
|
ensure => $ensure,
|
||||||
|
name => $::swift::params::client_package,
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,10 +2,14 @@
|
|||||||
#
|
#
|
||||||
# == Parameters
|
# == Parameters
|
||||||
# [*swift_hash_suffix*] string of text to be used
|
# [*swift_hash_suffix*] string of text to be used
|
||||||
# as a salt when hashing to determine mappings in the ring.
|
# as a salt when hashing to determine mappings in the ring.
|
||||||
# This file should be the same on every node in the cluster.
|
# This file should be the same on every node in the cluster.
|
||||||
|
#
|
||||||
# [*package_ensure*] The ensure state for the swift package.
|
# [*package_ensure*] The ensure state for the swift package.
|
||||||
# Optional. Defaults to present.
|
# (Optional) Defaults to present.
|
||||||
|
#
|
||||||
|
# [*client_package_ensure*] The ensure state for the swift client package.
|
||||||
|
# (Optional) Defaults to present.
|
||||||
#
|
#
|
||||||
# == Dependencies
|
# == Dependencies
|
||||||
#
|
#
|
||||||
@ -21,7 +25,8 @@
|
|||||||
#
|
#
|
||||||
class swift(
|
class swift(
|
||||||
$swift_hash_suffix,
|
$swift_hash_suffix,
|
||||||
$package_ensure = 'present'
|
$package_ensure = 'present',
|
||||||
|
$client_package_ensure = 'present',
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::params
|
include swift::params
|
||||||
@ -36,9 +41,8 @@ class swift(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package { 'swiftclient':
|
class { 'swift::client':
|
||||||
ensure => $package_ensure,
|
ensure => $client_package_ensure;
|
||||||
name => $::swift::params::client_package,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
File { owner => 'swift', group => 'swift', require => Package['swift'] }
|
File { owner => 'swift', group => 'swift', require => Package['swift'] }
|
||||||
|
16
spec/classes/swift_client_spec.rb
Normal file
16
spec/classes/swift_client_spec.rb
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'swift::client' do
|
||||||
|
|
||||||
|
describe "with default parameters" do
|
||||||
|
it { should contain_package('swiftclient').with_ensure('present') }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "with specified version" do
|
||||||
|
let :params do
|
||||||
|
{:ensure => '2.0.2-1'}
|
||||||
|
end
|
||||||
|
|
||||||
|
it { should contain_package('swiftclient').with_ensure(params[:ensure]) }
|
||||||
|
end
|
||||||
|
end
|
@ -60,9 +60,17 @@ describe 'swift' do
|
|||||||
|
|
||||||
describe 'when overriding package_ensure parameter' do
|
describe 'when overriding package_ensure parameter' do
|
||||||
it 'should effect ensure state of swift package' do
|
it 'should effect ensure state of swift package' do
|
||||||
params[:package_ensure] = 'latest'
|
params[:package_ensure] = '1.12.0-1'
|
||||||
subject.should contain_package('swift').with_ensure('latest')
|
subject.should contain_package('swift').with_ensure(params[:package_ensure])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'when overriding client_package_ensure parameter' do
|
||||||
|
it 'should effect ensure state of swift package' do
|
||||||
|
params[:client_package_ensure] = '2.0.2-1'
|
||||||
|
subject.should contain_package('swiftclient').with_ensure(params[:client_package_ensure])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user