From 24a1e2d410d668181bf659d0e2fe47fff2304514 Mon Sep 17 00:00:00 2001 From: Pawel Suder Date: Tue, 29 May 2018 08:38:21 +0200 Subject: [PATCH 1/2] Fix failing syntax tests Due to RuboCop settings, usage of %w[] was not working correctly. That change fixes that. Related to #1084 --- spec/functions/mysql_deepmerge_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/functions/mysql_deepmerge_spec.rb b/spec/functions/mysql_deepmerge_spec.rb index e44db6cd2..4987a5378 100644 --- a/spec/functions/mysql_deepmerge_spec.rb +++ b/spec/functions/mysql_deepmerge_spec.rb @@ -20,10 +20,10 @@ end # rubocop:disable RSpec/NamedSubject - index_values = %w[one two three] - expected_values_one = %w[1 2 2] + index_values = ['one', 'two', 'three'] + expected_values_one = [1, 2, 2] it 'is able to mysql_deepmerge two hashes' do - new_hash = subject.execute({ 'one' => '1', 'two' => '1' }, 'two' => '2', 'three' => '2') + new_hash = subject.execute({ 'one' => 1, 'two' => 1 }, 'two' => 2, 'three' => 2) index_values.each_with_index do |index, expected| expect(new_hash[index]).to eq(expected_values_one[expected]) end @@ -59,7 +59,7 @@ end end - index_values_two = %w[key1 key2] + index_values_two = ['key1', 'key2'] expected_values_four = [{ 'a' => 1, 'b' => 99 }, 'c' => 3] it 'appends to subhashes 3' do hash = subject.execute({ 'key1' => { 'a' => 1, 'b' => 2 }, 'key2' => { 'c' => 3 } }, 'key1' => { 'b' => 99 }) From 18f61e2f0588fa984f7b153a9b028ef8a02b8858 Mon Sep 17 00:00:00 2001 From: Pawel Suder Date: Mon, 28 May 2018 10:21:58 +0200 Subject: [PATCH 2/2] Add safe-updates for client That change introduces option safe-updates for mysql clients by setting it in ~/.my.cnf --- manifests/client.pp | 1 + manifests/params.pp | 1 + templates/my.cnf.pass.erb | 3 +++ 3 files changed, 5 insertions(+) diff --git a/manifests/client.pp b/manifests/client.pp index 58cd04f71..1c9df9d99 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -25,6 +25,7 @@ $package_ensure = $mysql::params::client_package_ensure, $package_manage = $mysql::params::client_package_manage, $package_name = $mysql::params::client_package_name, + $safe_updates = $mysql::params::safe_updates, ) inherits mysql::params { include '::mysql::client::install' diff --git a/manifests/params.pp b/manifests/params.pp index e28fa0071..17ed73da5 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -18,6 +18,7 @@ $client_package_manage = true $create_root_user = true $create_root_my_cnf = true + $safe_updates = false # mysql::bindings $bindings_enable = false $java_package_ensure = 'present' diff --git a/templates/my.cnf.pass.erb b/templates/my.cnf.pass.erb index b82cca3f7..9af7079aa 100644 --- a/templates/my.cnf.pass.erb +++ b/templates/my.cnf.pass.erb @@ -4,6 +4,9 @@ [<%= section -%>] user=root host=localhost +<% if section == 'client' and scope.lookupvar('mysql::client::safe_updates') != 'UNSET' -%> +safe-updates=<%= scope.lookupvar('mysql::client::safe_updates') ? 1 : 0 %> +<% end -%> <% unless scope.lookupvar('mysql::server::root_password') == 'UNSET' -%> password='<%= scope.lookupvar('mysql::server::root_password') %>' <% end -%>