Skip to content

Commit

Permalink
fix bug in GH-578
Browse files Browse the repository at this point in the history
the recently added feature to support galera by allowing independent
creation of the root@localhost user in the DB and the /root/.my.cnf
file contains a bug.

specifically the .my.cnf file resource still requires the root@localhost
resource, even when it is not available.

this fixes the issue by making the dependency conditional.
  • Loading branch information
David Gurtner committed Feb 16, 2015
1 parent efa2f58 commit b3c33f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion manifests/server/root_password.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
content => template('mysql/my.cnf.pass.erb'),
owner => 'root',
mode => '0600',
require => Mysql_user['root@localhost'],
}
if $mysql::server::create_root_user == true {
Mysql_user['root@localhost'] -> File["${::root_home}/.my.cnf"]
}
}

Expand Down
2 changes: 1 addition & 1 deletion spec/classes/mysql_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
describe 'when root_password set' do
let(:params) {{:root_password => 'SET' }}
it { is_expected.to contain_mysql_user('root@localhost') }
it { is_expected.to contain_file('/root/.my.cnf') }
it { is_expected.to contain_file('/root/.my.cnf').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 }}
Expand Down

0 comments on commit b3c33f0

Please sign in to comment.