From 765b5c252754bc1e4303d90a344edf54ddd28d65 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Sat, 13 Oct 2012 02:35:38 -0700 Subject: [PATCH] Create /root/.my.cnf even when root passwd is not managed When the root password is not managed, it causes mysql to fail b/c it does not create the /root/.my.cnf file (which causes all mysql commands from the provider to fail) --- manifests/config.pp | 5 +++++ spec/classes/mysql_config_spec.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/config.pp b/manifests/config.pp index 5095340..16568a2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -116,6 +116,11 @@ class mysql::config( require => Exec['set_mysql_rootpw'], } } + } else { + file { '/root/.my.cnf': + ensure => present, + require => Exec['set_mysql_rootpw'], + } } file { '/etc/mysql': diff --git a/spec/classes/mysql_config_spec.rb b/spec/classes/mysql_config_spec.rb index fab8899..16f97c4 100644 --- a/spec/classes/mysql_config_spec.rb +++ b/spec/classes/mysql_config_spec.rb @@ -130,7 +130,7 @@ describe 'mysql::config' do it { should_not contain_exec('set_mysql_rootpw') } - it { should_not contain_file('/root/.my.cnf')} + it { should contain_file('/root/.my.cnf')} it { should contain_file('/etc/mysql').with( 'owner' => 'root',