Improve File resources idempotency
* use selinux_ignore_defaults parameter for directory to avoid this kind of issue: (...) seltype: seltype changed 'swift_var_run_t' to 'var_run_t' * Do not manage ownership for /etc/swift/*-server to avoid this kind of issue: (...) owner changed 'root' to 'swift' * Do not manage /etc/init.d/swift-container-sync file, already managed by packaging: ~ dpkg -S /etc/init.d/swift-container-sync swift-container: /etc/init.d/swift-container-sync Change-Id: I1d742d118943fb0b11c47fd322052f50156e2994
This commit is contained in:
parent
981fcaeb53
commit
c0a1195f53
@ -61,7 +61,8 @@ class swift(
|
||||
ensure => directory,
|
||||
}
|
||||
file { '/var/run/swift':
|
||||
ensure => directory,
|
||||
ensure => directory,
|
||||
selinux_ignore_defaults => true,
|
||||
}
|
||||
|
||||
file { '/etc/swift/swift.conf':
|
||||
|
@ -111,10 +111,11 @@ class swift::proxy::authtoken(
|
||||
}
|
||||
|
||||
file { $signing_dir:
|
||||
ensure => directory,
|
||||
mode => '0700',
|
||||
owner => 'swift',
|
||||
group => 'swift',
|
||||
ensure => directory,
|
||||
mode => '0700',
|
||||
owner => 'swift',
|
||||
group => 'swift',
|
||||
selinux_ignore_defaults => true,
|
||||
}
|
||||
|
||||
concat::fragment { 'swift_authtoken':
|
||||
|
@ -67,15 +67,11 @@ class swift::storage::container(
|
||||
source => 'puppet:///modules/swift/swift-container-sync.conf.upstart',
|
||||
require => Package['swift-container'],
|
||||
}
|
||||
file { '/etc/init.d/swift-container-sync':
|
||||
ensure => link,
|
||||
target => '/lib/init/upstart-job',
|
||||
}
|
||||
service { 'swift-container-sync':
|
||||
ensure => $service_ensure,
|
||||
enable => $enabled,
|
||||
provider => $::swift::params::service_provider,
|
||||
require => File['/etc/init/swift-container-sync.conf', '/etc/init.d/swift-container-sync'],
|
||||
require => File['/etc/init/swift-container-sync.conf'],
|
||||
}
|
||||
Swift_config<| |> ~> Service['swift-container-sync']
|
||||
}
|
||||
|
@ -53,8 +53,6 @@ define swift::storage::generic(
|
||||
|
||||
file { "/etc/swift/${name}-server/":
|
||||
ensure => directory,
|
||||
owner => 'swift',
|
||||
group => 'swift',
|
||||
}
|
||||
|
||||
if $manage_service {
|
||||
|
@ -22,7 +22,8 @@ describe 'swift::proxy::authtoken' do
|
||||
}
|
||||
end
|
||||
it {is_expected.to contain_file('/var/cache/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,8 @@ describe 'swift' do
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/run/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
{:ensure => 'directory',
|
||||
:selinux_ignore_defaults => true}.merge(file_defaults)
|
||||
)}
|
||||
it {is_expected.to contain_file('/var/lib/swift').with(
|
||||
{:ensure => 'directory'}.merge(file_defaults)
|
||||
|
@ -74,9 +74,7 @@ describe 'swift::storage::all' do
|
||||
}
|
||||
)}
|
||||
it { is_expected.to contain_file("/etc/swift/#{type}-server/").with(
|
||||
{:ensure => 'directory',
|
||||
:owner => 'swift',
|
||||
:group => 'swift'}
|
||||
{:ensure => 'directory'}
|
||||
)}
|
||||
end
|
||||
|
||||
|
@ -91,16 +91,12 @@ describe 'swift::storage::container' do
|
||||
:ensure => 'running',
|
||||
:enable => true,
|
||||
:provider => 'upstart',
|
||||
:require => ['File[/etc/init/swift-container-sync.conf]', 'File[/etc/init.d/swift-container-sync]']
|
||||
:require => 'File[/etc/init/swift-container-sync.conf]',
|
||||
)
|
||||
is_expected.to contain_file('/etc/init/swift-container-sync.conf').with(
|
||||
:source => 'puppet:///modules/swift/swift-container-sync.conf.upstart',
|
||||
:require => 'Package[swift-container]'
|
||||
)
|
||||
is_expected.to contain_file('/etc/init.d/swift-container-sync').with(
|
||||
:ensure => 'link',
|
||||
:target => '/lib/init/upstart-job'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -65,8 +65,6 @@ describe 'swift::storage::generic' do
|
||||
)}
|
||||
it { is_expected.to contain_file("/etc/swift/#{t}-server/").with(
|
||||
:ensure => 'directory',
|
||||
:owner => 'swift',
|
||||
:group => 'swift'
|
||||
)}
|
||||
end
|
||||
# TODO - I do not want to add tests for the upstart stuff
|
||||
|
Loading…
Reference in New Issue
Block a user