From 4faa3f12ee63d24a9f58f41e873d00a93d978943 Mon Sep 17 00:00:00 2001 From: Sergii Golovatiuk Date: Thu, 18 Feb 2016 11:48:16 +0100 Subject: [PATCH] Generate .my.cnf for all sections MySQL ecosystem has a lot of tools that use .my.cnf such as mysqldump or mysqladmin. Generating all sections allows operator to use them under root account without passing -p --- templates/my.cnf.pass.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/templates/my.cnf.pass.erb b/templates/my.cnf.pass.erb index c045665..b82cca3 100644 --- a/templates/my.cnf.pass.erb +++ b/templates/my.cnf.pass.erb @@ -1,9 +1,11 @@ ### MANAGED BY PUPPET ### -[client] +<% %w(mysql client mysqldump mysqladmin mysqlcheck).each do |section| %> +[<%= section -%>] user=root host=localhost <% unless scope.lookupvar('mysql::server::root_password') == 'UNSET' -%> password='<%= scope.lookupvar('mysql::server::root_password') %>' <% end -%> -socket=<%= @options['client']['socket'] -%> +socket=<%= @options['client']['socket'] %> +<% end %>