Skip to content

Commit

Permalink
Ensure idempotency between Puppet runs
Browse files Browse the repository at this point in the history
Running RHEL 7.1 with 'yum' provider, puppetlabs-rabbitmq is not
idempotent.
After a second run, puppet tries to change the SElinux context:
/File[/etc/systemd/system/rabbitmq-server.service.d]/seltype: seltype
changed 'rabbitmq_unit_file_t' to 'systemd_unit_file_t'

Since packaging already manages SElinux labels, we should not let Puppet
doing it (default behavior).
This patch aims to set selinux_ignore_defaults to True for the File
resource (/etc/systemd/system/rabbitmq-server.service.d).

Thanks to that patch, Puppet will be indempotent between all runs on
RHEL platforms.
  • Loading branch information
EmilienM committed May 13, 2015
1 parent 5d71d50 commit 0227f76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@
'RedHat': {
if versioncmp($::operatingsystemmajrelease, '7') >= 0 {
file { '/etc/systemd/system/rabbitmq-server.service.d':
ensure => directory,
owner => '0',
group => '0',
mode => '0755',
ensure => directory,
owner => '0',
group => '0',
mode => '0755',
selinux_ignore_defaults => true,
} ->
file { '/etc/systemd/system/rabbitmq-server.service.d/limits.conf':
content => template('rabbitmq/rabbitmq-server.service.d/limits.conf'),
Expand Down
9 changes: 5 additions & 4 deletions spec/classes/rabbitmq_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@
let(:facts) {{ :osfamily => 'RedHat', :operatingsystemmajrelease => '7' }}

it { should contain_file('/etc/systemd/system/rabbitmq-server.service.d').with(
'ensure' => 'directory',
'owner' => '0',
'group' => '0',
'mode' => '0755'
'ensure' => 'directory',
'owner' => '0',
'group' => '0',
'mode' => '0755',
'selinux_ignore_defaults' => true
) }

it { should contain_exec('rabbitmq-systemd-reload').with(
Expand Down

0 comments on commit 0227f76

Please sign in to comment.