Skip to content

Commit

Permalink
(maint) drop some puppet 3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
h0tw1r3 committed May 4, 2024
1 parent 72fd570 commit 459be93
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
11 changes: 4 additions & 7 deletions manifests/server/root_password.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,12 @@
if $mysql::server::create_root_my_cnf and $root_password_set {
# TODO: use EPP instead of ERB, as EPP can handle Data of Type Sensitive without further ado
file { "${facts['root_home']}/.my.cnf":
content => epp('mysql/my.cnf.pass.epp',$parameters),
owner => 'root',
mode => '0600',
content => epp('mysql/my.cnf.pass.epp',$parameters),
owner => 'root',
mode => '0600',
show_diff => false,
}

# show_diff was added with puppet 3.0
if versioncmp($facts['puppetversion'], '3.0') >= 0 {
File["${facts['root_home']}/.my.cnf"] { show_diff => false }
}
if $mysql::server::create_root_user {
Mysql_user['root@localhost'] -> File["${facts['root_home']}/.my.cnf"]
}
Expand Down
12 changes: 2 additions & 10 deletions spec/classes/mysql_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,15 @@

it { is_expected.to contain_mysql_user('root@localhost') }

if Puppet.version.to_f >= 3.0
it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false).that_requires('Mysql_user[root@localhost]') }
else
it { is_expected.to contain_file('/root/.my.cnf').that_requires('Mysql_user[root@localhost]') }
end
it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false).that_requires('Mysql_user[root@localhost]') }
end

describe 'when root_password set, create_root_user set to false' do
let(:params) { { root_password: 'SET', create_root_user: false } }

it { is_expected.not_to contain_mysql_user('root@localhost') }

if Puppet.version.to_f >= 3.0
it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false) }
else
it { is_expected.to contain_file('/root/.my.cnf') }
end
it { is_expected.to contain_file('/root/.my.cnf').with(show_diff: false) }
end

describe 'when root_password set, create_root_my_cnf set to false' do
Expand Down

0 comments on commit 459be93

Please sign in to comment.