Properly support of Puppet4 in the cluster::virtual_ip

This commit fixes mutating operations on array/hash types.
Also this commit contain some cleanups according the styling guide.

Change-Id: I4c6d1d30c93f77a870927c5cfac9793d37e279ab
Closes-Bug: #1530395
This commit is contained in:
Maksim Malchuk 2016-01-01 22:16:02 +03:00
parent 49fb58a958
commit 9dfb877ef6

View File

@ -4,7 +4,7 @@
#
# === Parameters
#
# [*name*]
# [*key*]
# Name of virtual IP resource
#
# [*vip*]
@ -21,7 +21,14 @@ define cluster::virtual_ip (
$vip_name = "vip__${key}"
if (is_ip_address($vip['gateway']) or ($vip['gateway'] == 'link')) {
$gateway = $vip['gateway']
} else {
$gateway = 'none'
}
$parameters = {
'gateway' => $gateway,
'bridge' => $vip['bridge'],
'base_veth' => $vip['base_veth'],
'ns_veth' => $vip['ns_veth'],
@ -48,24 +55,18 @@ define cluster::virtual_ip (
},
'iptables_comment' => $vip['iptables_comment'] ? {
undef => undef, false => undef,
default => "${vip['iptables_comment']}",
default => $vip['iptables_comment'],
},
'ns_iptables_start_rules' => $vip['ns_iptables_start_rules'] ? {
undef => undef, false => undef,
default => "${vip['ns_iptables_start_rules']}",
default => $vip['ns_iptables_start_rules'],
},
'ns_iptables_stop_rules' => $vip['ns_iptables_stop_rules'] ? {
undef => undef, false => undef,
default => "${vip['ns_iptables_stop_rules']}",
default => $vip['ns_iptables_stop_rules'],
},
}
if (is_ip_address($vip['gateway']) or ($vip['gateway'] == 'link')) {
$parameters['gateway'] = $vip['gateway']
} else {
$parameters['gateway'] = 'none'
}
$metadata = {
'migration-threshold' => '3', # will be try start 3 times before migrate to another node
'failure-timeout' => '60', # forget any fails of starts after this timeout