From 475b7ebcd03afe9a7aa391194f75aec22d0521cf Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin Date: Tue, 31 May 2016 03:04:25 +0300 Subject: [PATCH] Pacemaker misc fixes Add missing package, add mising parameters, fix functions. Change-Id: Ib885af7df8fc2b678272fe85e5d8bbdd9aa1988b --- .../functions/pacemaker_cluster_nodes.rb | 1 + .../pacemaker_resource_parameters.rb | 5 +-- manifests/new.pp | 34 +++++++++---------- manifests/new/params.pp | 2 +- .../pacemaker_resource_parameters_spec.rb | 4 +-- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/puppet/parser/functions/pacemaker_cluster_nodes.rb b/lib/puppet/parser/functions/pacemaker_cluster_nodes.rb index 043e5621..14716a09 100644 --- a/lib/puppet/parser/functions/pacemaker_cluster_nodes.rb +++ b/lib/puppet/parser/functions/pacemaker_cluster_nodes.rb @@ -146,6 +146,7 @@ Output forms: fail "Data is not a hash: #{hash.inspect}" unless hash.is_a? Hash node_list = [] hash.each do |node_name, node| + node = node.dup node['name'] = node_name if node_name and not node['name'] node_hash = node_hash_process.call node next unless node_hash['ring0'] or node_hash['ring1'] diff --git a/lib/puppet/parser/functions/pacemaker_resource_parameters.rb b/lib/puppet/parser/functions/pacemaker_resource_parameters.rb index 226e7f2e..28ce4c2d 100644 --- a/lib/puppet/parser/functions/pacemaker_resource_parameters.rb +++ b/lib/puppet/parser/functions/pacemaker_resource_parameters.rb @@ -4,7 +4,7 @@ module Puppet::Parser::Functions type: :rvalue, arity: -1, doc: <<-eof - Gather resource parameters and their values +Gather resource parameters and their values eof ) do |args| parameters = {} @@ -15,10 +15,11 @@ module Puppet::Parser::Functions next if key.nil? next if value.nil? next if value == '' + next if value == :undef key = key.to_s parameters.store key, value end end parameters end -end \ No newline at end of file +end diff --git a/manifests/new.pp b/manifests/new.pp index 39c4c244..cb7df11b 100644 --- a/manifests/new.pp +++ b/manifests/new.pp @@ -15,23 +15,23 @@ class pacemaker::new ( $package_ensure = $::pacemaker::new::params::package_ensure, $package_provider = $::pacemaker::new::params::package_provider, - $pcsd_mode = $::pacemaker::new::params::pcsd_mode, - - $cluster_nodes = $::pacemaker::new::params::cluster_nodes, - $cluster_rrp_nodes = $::pacemaker::new::params::cluster_rrp_nodes, - $cluster_name = $::pacemaker::new::params::cluster_name, - $cluster_auth_key = $::pacemaker::new::params::cluster_auth_key, - $cluster_setup = $::pacemaker::new::params::cluster_setup, - $cluster_options = $::pacemaker::new::params::cluster_options, - $cluster_user = $::pacemaker::new::params::cluster_user, - $cluster_password = $::pacemaker::new::params::cluster_password, - $pcs_bin_path = $::pacemaker::new::params::pcs_bin_path, - - $cluster_config_path = $::pacemaker::new::params::cluster_config_path, - $cluster_interfaces = $::pacemaker::new::params::cluster_interfaces, - $cluster_log_subsys = $::pacemaker::new::params::cluster_log_subsys, - $plugin_version = $::pacemaker::new::params::plugin_version, - $log_file_path = $::pacemaker::new::params::log_file_path, + $pcsd_mode = $::pacemaker::new::params::pcsd_mode, + $cluster_nodes = $::pacemaker::new::params::cluster_nodes, + $cluster_rrp_nodes = $::pacemaker::new::params::cluster_rrp_nodes, + $cluster_name = $::pacemaker::new::params::cluster_name, + $cluster_auth_key = $::pacemaker::new::params::cluster_auth_key, + $cluster_auth_enabled = $::pacemaker::new::params::cluster_auth_enabled, + $cluster_setup = $::pacemaker::new::params::cluster_setup, + $cluster_options = $::pacemaker::new::params::cluster_options, + $cluster_user = $::pacemaker::new::params::cluster_user, + $cluster_group = $::pacemaker::new::params::cluster_group, + $cluster_password = $::pacemaker::new::params::cluster_password, + $pcs_bin_path = $::pacemaker::new::params::pcs_bin_path, + $cluster_config_path = $::pacemaker::new::params::cluster_config_path, + $cluster_interfaces = $::pacemaker::new::params::cluster_interfaces, + $cluster_log_subsys = $::pacemaker::new::params::cluster_log_subsys, + $plugin_version = $::pacemaker::new::params::plugin_version, + $log_file_path = $::pacemaker::new::params::log_file_path, $pcsd_manage = $::pacemaker::new::params::pcsd_manage, $pcsd_enable = $::pacemaker::new::params::pcsd_enable, diff --git a/manifests/new/params.pp b/manifests/new/params.pp index 6892b1ba..1f028bd2 100644 --- a/manifests/new/params.pp +++ b/manifests/new/params.pp @@ -24,7 +24,7 @@ class pacemaker::new::params { $log_file_path = '/var/log/cluster/corosync.log' } elsif $::osfamily == 'Debian' { $pcsd_mode = false - $package_list = ['pacemaker-mgmt', 'pacemaker', 'corosync', 'pacemaker-cli-utils', 'resource-agents'] + $package_list = ['pacemaker-mgmt', 'pacemaker', 'corosync', 'pacemaker-cli-utils', 'resource-agents', 'crmsh'] $cluster_user = 'root' $cluster_group = 'root' $log_file_path = '/var/log/corosync/corosync.log' diff --git a/spec/functions/pacemaker_resource_parameters_spec.rb b/spec/functions/pacemaker_resource_parameters_spec.rb index 580327d9..c8f21d2a 100644 --- a/spec/functions/pacemaker_resource_parameters_spec.rb +++ b/spec/functions/pacemaker_resource_parameters_spec.rb @@ -15,7 +15,7 @@ describe 'pacemaker_resource_parameters' do it { is_expected.to run.with_params('a', 'b').and_return({'a' => 'b'}) } - it { is_expected.to run.with_params('a', 'b', 'c', nil, ['d', 1]).and_return({'a' => 'b', 'd' => 1}) } + it { is_expected.to run.with_params('a', 'b', 'c', nil, ['d', 1], 'e', :undef).and_return({'a' => 'b', 'd' => 1}) } it { is_expected.to run.with_params('a', 'b', 'c', 'd', {'e' => 'f', 'a' => '10'}).and_return({'a' => '10', 'c' => 'd', 'e' => 'f'}) } -end \ No newline at end of file +end