From c4817c654797638bf16b54f4f9b69ed3715625cb Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 25 Feb 2017 19:25:34 +0000 Subject: [PATCH] Make sure chef mysql configuration overrides defaults --- cookbooks/mysql/recipes/default.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cookbooks/mysql/recipes/default.rb b/cookbooks/mysql/recipes/default.rb index 49087e67a..07835e729 100644 --- a/cookbooks/mysql/recipes/default.rb +++ b/cookbooks/mysql/recipes/default.rb @@ -25,7 +25,18 @@ service "mysql" do supports :status => true, :restart => true end -template "/etc/mysql/conf.d/chef.cnf" do +file "/etc/mysql/conf.d/chef.cnf" do + action :delete + notifies :restart, "service[mysql]" +end + +conf_file = if node[:lsb][:release].to_f >= 16.04 + "/etc/mysql/mysql.conf.d/zzz-chef.cnf" + else + "/etc/mysql/conf.d/zzz-chef.cnf" + end + +template conf_file do source "my.cnf.erb" owner "root" group "root" -- 2.43.2