handle undefined values in cs_resource provider
for prevent passing to pacemaker commands, like: gateway=none gateway_metric=0 other_networks= iptables_comment= ns_iptables_start_rules= Change-Id: Ic20e88c747a4674987e87e6318813166d94d2446 Closes-bug: #1487459
This commit is contained in:
parent
06fbfd2bb2
commit
cd059d921c
@ -28,7 +28,7 @@ class cluster::haproxy_ocf (
|
||||
parameters => {
|
||||
'ns' => 'haproxy',
|
||||
'debug' => $debug,
|
||||
'other_networks' => "'$other_networks'",
|
||||
'other_networks' => "${other_networks}",
|
||||
},
|
||||
operations => {
|
||||
'monitor' => {
|
||||
|
@ -57,27 +57,27 @@ define cluster::virtual_ip (
|
||||
'iptables_start_rules' => $vip['iptables_start_rules'] ? {
|
||||
undef => 'false',
|
||||
'' => 'false',
|
||||
default => "'${vip['iptables_start_rules']}'",
|
||||
default => "${vip['iptables_start_rules']}",
|
||||
},
|
||||
'iptables_stop_rules' => $vip['iptables_stop_rules'] ? {
|
||||
undef => 'false',
|
||||
'' => 'false',
|
||||
default => "'${vip['iptables_stop_rules']}'",
|
||||
default => "${vip['iptables_stop_rules']}",
|
||||
},
|
||||
'iptables_comment' => $vip['iptables_comment'] ? {
|
||||
undef => 'false',
|
||||
'' => 'false',
|
||||
default => "'${vip['iptables_comment']}'",
|
||||
default => "${vip['iptables_comment']}",
|
||||
},
|
||||
'ns_iptables_start_rules' => $vip['ns_iptables_start_rules'] ? {
|
||||
undef => 'false',
|
||||
'' => 'false',
|
||||
default => "'${vip['ns_iptables_start_rules']}'",
|
||||
default => "${vip['ns_iptables_start_rules']}",
|
||||
},
|
||||
'ns_iptables_stop_rules' => $vip['ns_iptables_stop_rules'] ? {
|
||||
undef => 'false',
|
||||
'' => 'false',
|
||||
default => "'${vip['ns_iptables_stop_rules']}'",
|
||||
default => "${vip['ns_iptables_stop_rules']}",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ class cluster::vrouter_ocf (
|
||||
}
|
||||
$parameters = {
|
||||
'ns' => 'vrouter',
|
||||
'other_networks' => "'$other_networks'",
|
||||
'other_networks' => "${other_networks}",
|
||||
}
|
||||
$operations = {
|
||||
'monitor' => {
|
||||
|
@ -185,23 +185,19 @@ Puppet::Type.type(:cs_resource).provide(:crm, :parent => Puppet::Provider::Pacem
|
||||
end
|
||||
operations << "op #{op_namerole[0]} "
|
||||
o[1].each_pair do |k,v|
|
||||
operations << "#{k}=#{v} "
|
||||
operations << "#{k}='#{v}' " unless v.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
unless @property_hash[:parameters].empty?
|
||||
parameters = 'params '
|
||||
@property_hash[:parameters].each_pair do |k,v|
|
||||
parameters << "#{k}=#{v} "
|
||||
end
|
||||
parameters = @property_hash[:parameters].reject{|k,v| v.empty?}.map{|k,v| "#{k}='#{v}'"}.join(' ')
|
||||
parameters = (parameters.empty? ? nil : "params #{parameters}")
|
||||
end
|
||||
|
||||
unless @property_hash[:metadata].empty?
|
||||
metadatas = 'meta '
|
||||
@property_hash[:metadata].each_pair do |k,v|
|
||||
metadatas << "#{k}=#{v} "
|
||||
end
|
||||
metadatas = @property_hash[:metadata].reject{|k,v| v.empty?}.map{|k,v| "#{k}='#{v}'"}.join(' ')
|
||||
metadatas = (metadatas.empty? ? nil : "meta #{metadatas}")
|
||||
end
|
||||
|
||||
updated = 'primitive '
|
||||
@ -219,9 +215,9 @@ Puppet::Type.type(:cs_resource).provide(:crm, :parent => Puppet::Provider::Pacem
|
||||
updated << "\n"
|
||||
updated << " #{crm_cmd_type} #{complex_name} #{@property_hash[:name]} "
|
||||
unless @property_hash[:ms_metadata].empty?
|
||||
updated << 'meta '
|
||||
@property_hash[:ms_metadata].each_pair do |k,v|
|
||||
updated << "#{k}=#{v} "
|
||||
ms_metadatas = @property_hash[:ms_metadata].reject{|k,v| v.empty?}.map{|k,v| "#{k}='#{v}'"}.join(' ')
|
||||
unless ms_metadatas.empty?
|
||||
updated << "meta #{ms_metadatas}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user