From ea2d58c7c372fe5a24339e25d7eae5d5d99fb6ad Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 23 Mar 2017 14:14:51 +0100 Subject: [PATCH] replace validate_integer with datatype --- manifests/bond/debian.pp | 41 ++++++++++++++++---------------- spec/defines/bond/debian_spec.rb | 2 +- spec/defines/bond_spec.rb | 2 +- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/manifests/bond/debian.pp b/manifests/bond/debian.pp index 927dcb68..20d4b90d 100644 --- a/manifests/bond/debian.pp +++ b/manifests/bond/debian.pp @@ -7,25 +7,24 @@ # * Debian Network Bonding http://wiki.debian.org/Bonding define network::bond::debian( $slaves, - $ensure = present, - $ipaddress = undef, - $netmask = undef, - $method = undef, - $family = undef, - $onboot = undef, - $hotplug = undef, - $mtu = undef, - $options = undef, - $slave_options = undef, - - $mode = undef, - $miimon = undef, - $downdelay = undef, - $updelay = undef, - $lacp_rate = undef, - $primary = undef, - $primary_reselect = undef, - $xmit_hash_policy = undef, + $ensure = present, + $ipaddress = undef, + $netmask = undef, + $method = undef, + $family = undef, + $onboot = undef, + $hotplug = undef, + Optional[Variant[Integer[42, 65536],String]] $mtu = undef, + $options = undef, + $slave_options = undef, + $mode = undef, + $miimon = undef, + $downdelay = undef, + $updelay = undef, + $lacp_rate = undef, + $primary = undef, + $primary_reselect = undef, + $xmit_hash_policy = undef, ) { $raw = { @@ -40,9 +39,11 @@ 'bond-xmit-hash-policy' => $xmit_hash_policy, } + if $mtu =~ String { + warning('$mtu should be an integer and will change in future releases') + } if $mtu { # https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1224007 - validate_integer([$mtu], 65536, 42) $raw_post_up = { 'post-up' => "ip link set dev ${name} mtu ${mtu}", } } else { $raw_post_up = {} diff --git a/spec/defines/bond/debian_spec.rb b/spec/defines/bond/debian_spec.rb index d02da980..08f8e5f5 100644 --- a/spec/defines/bond/debian_spec.rb +++ b/spec/defines/bond/debian_spec.rb @@ -56,7 +56,7 @@ 'ipaddress' => '10.20.2.1', 'netmask' => '255.255.255.192', 'slaves' => %w(eth0 eth1 eth2), - 'mtu' => '1550', + 'mtu' => 1550, 'options' => { 'bond-future-option' => 'yes' }, 'slave_options' => { 'slave-future-option' => 'no' }, 'hotplug' => 'false', diff --git a/spec/defines/bond_spec.rb b/spec/defines/bond_spec.rb index b4d29d1f..056e947c 100644 --- a/spec/defines/bond_spec.rb +++ b/spec/defines/bond_spec.rb @@ -10,7 +10,7 @@ 'ipaddress' => '172.18.1.2', 'netmask' => '255.255.128.0', 'slaves' => %w(eth0 eth1), - 'mtu' => '1550', + 'mtu' => 1550, 'options' => { 'NM_CONTROLLED' => 'yes' }, 'slave_options' => { 'NM_CONTROLLED' => 'no' },