Use swift_config to configure swift.conf

This change also adds an autorequire in the swift_config
type to ensure the /etc/swift/swift.conf exists.

Change-Id: Ic591a3ceb040c4599339ed7f750a5273d2052ac1
Implements: blueprint puppet-swift-ini-settings
This commit is contained in:
Dan Prince 2013-08-26 08:34:45 -04:00
parent f10bcda7e6
commit c89e327fb8
4 changed files with 13 additions and 4 deletions
lib/puppet/type
manifests
spec/classes
templates

@ -37,4 +37,10 @@ Puppet::Type.newtype(:swift_config) do
newvalues(:true, :false)
defaultto false
end
# Require the swift.conf to be present
autorequire(:file) do
['/etc/swift/swift.conf']
end
end

@ -66,7 +66,9 @@ class swift(
file { '/etc/swift/swift.conf':
ensure => present,
mode => '0660',
content => template('swift/swift.conf.erb'),
}
swift_config { 'swift-hash/swift_hash_path_suffix':
value => $swift_hash_suffix
}
}

@ -45,9 +45,12 @@ describe 'swift' do
it {should contain_file('/etc/swift/swift.conf').with(
{:ensure => 'present',
:mode => '0660',
:content => "[swift-hash]\nswift_hash_path_suffix = string\n"
}.merge(file_defaults)
)}
it 'configures swift.conf' do
should contain_swift_config(
'swift-hash/swift_hash_path_suffix').with_value('string')
end
it {should contain_package('swift').with_ensure('present')}
it {should contain_user('swift')}
it {should contain_file('/var/lib/swift').with_ensure('directory')}

@ -1,2 +0,0 @@
[swift-hash]
swift_hash_path_suffix = <%= @swift_hash_suffix %>