Ensure idempotency between Puppet runs

Running RHEL 7.1, puppetlabs-mysql is not idempotent.
After a second run, puppet tries to change the SElinux context:
/File[mysql-config-file]/seltype: seltype changed 'etc_t' to
'mysqld_etc_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
mysql-config-file File resource.

Thanks to that patch, Puppet will be indempotent between all runs on
RHEL platforms.
This commit is contained in:
Emilien Macchi 2015-08-04 13:38:03 -04:00
parent fd03318331
commit ba52d1d6e9
2 changed files with 6 additions and 4 deletions

View file

@ -37,9 +37,10 @@ class mysql::server::config {
if $mysql::server::manage_config_file {
file { 'mysql-config-file':
path => $mysql::server::config_file,
content => template('mysql/my.cnf.erb'),
mode => '0644',
path => $mysql::server::config_file,
content => template('mysql/my.cnf.erb'),
mode => '0644',
selinux_ignore_defaults => true,
}
}

View file

@ -11,7 +11,8 @@ describe 'mysql::server' do
let(:params) {{ :override_options => { 'mysqld' => { 'socket' => '/var/lib/mysql/mysql.sock' } } }}
it do
is_expected.to contain_file('mysql-config-file').with({
:mode => '0644',
:mode => '0644',
:selinux_ignore_defaults => true,
}).with_content(/socket = \/var\/lib\/mysql\/mysql.sock/)
end
end