From b58c0314267a427cfc1b729dfbbd43dfb363de6b Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 2 Apr 2015 22:32:43 -0700 Subject: [PATCH 01/10] Get code ready for Puppet 4 via modulesync. --- .travis.yml | 8 ++++++++ Gemfile | 22 +++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4e4874df..2b07e890 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,9 +26,17 @@ matrix: env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="4.0.0.rc1" allow_failures: - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.0 + env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + - rvm: 2.1.5 + env: PUPPET_GEM_VERSION="4.0.0.rc1" notifications: email: - github@razorsedge.org diff --git a/Gemfile b/Gemfile index a24d3b9b..c01e9721 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,19 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do - gem 'rake', :require => false - gem 'rspec', '~> 2.0', :require => false - gem 'rspec-puppet', '~> 2.0', :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', '>= 1.1.0', :require => false - gem 'simplecov', :require => false - gem 'puppet_facts', :require => false - gem 'json', :require => false - gem 'metadata-json-lint', '>= 0.0.4', :require => false + gem 'rake', :require => false + gem 'rspec', '~> 2.0', :require => false + gem 'rspec-puppet', '~> 2.0', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint', '>= 1.1.0', :require => false + gem 'simplecov', :require => false + gem 'puppet_facts', :require => false + gem 'json', :require => false + gem 'metadata-json-lint', '>= 0.0.4', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + gem 'puppet-lint-empty_string-check', :require => false + gem 'puppet-lint-leading_zero-check', :require => false + gem 'puppet-lint-variable_contains_upcase', :require => false end if facterversion = ENV['FACTER_GEM_VERSION'] From 7a7adfbdeae31848792c6162cdacac4d44587eb7 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Sun, 19 Apr 2015 14:46:21 -0700 Subject: [PATCH 02/10] Update Puppet 4 gem and support puppet_blacksmith with modulesync. --- .travis.yml | 4 ++-- Rakefile | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2b07e890..91c42402 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,14 +29,14 @@ matrix: - rvm: 2.1.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="4.0.0.rc1" + env: PUPPET_GEM_VERSION="~> 4.0" allow_failures: - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.0 env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="4.0.0.rc1" + env: PUPPET_GEM_VERSION="~> 4.0" notifications: email: - github@razorsedge.org diff --git a/Rakefile b/Rakefile index 8940e1e0..91187c37 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,11 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' require 'metadata-json-lint/rake_task' +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError +end + Rake::Task[:lint].clear PuppetLint::RakeTask.new :lint do |config| config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"] From 5783b9f186377532358bef0dfbd98b609fcd4799 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Tue, 21 Apr 2015 22:57:04 -0700 Subject: [PATCH 03/10] Update Geppetto .project. --- .project | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.project b/.project index ba47ff3f..e5ccbff6 100644 --- a/.project +++ b/.project @@ -40,5 +40,14 @@ 1.0-projectRelativePath-matches-false-false-spec/fixtures/modules + + 1428386119416 + + 10 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-.vendor + + From 954bcfd4c189d75cb381cbf90398d503a0dee6b7 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Sun, 26 Apr 2015 12:47:21 -0700 Subject: [PATCH 04/10] Remove erroneous IPv6 support statement from README.md. --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index badb1545..72c0b769 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,6 @@ Notes * bootp support is unknown for bonded interfaces. Thus no bootp bond support in this module. * It is assumed that if you create a bond that you also create the slave interface(s). * It is assumed that if you create an alias that you also create the parent interface. -* There is currently no IPv6 support in this module. * network::route requires the referenced device to also be defined via network::if or network::bond. * For VLANs to work, `Class['network::global']` must have parameter `vlan` set to `yes`. * To enable IPv6 you have to set both `ipv6networking` in `Class['network::global']` to `true` and `ipv6init` in `network::if::static` to `true`. From c00cefbad90d262fc42503119a98792a27f93401 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Sun, 26 Apr 2015 13:20:25 -0700 Subject: [PATCH 05/10] Fix lint: class included by relative name. --- manifests/alias/range.pp | 2 +- manifests/bond/slave.pp | 2 +- manifests/bridge.pp | 2 +- manifests/bridge/dynamic.pp | 2 +- manifests/bridge/static.pp | 2 +- manifests/global.pp | 2 +- manifests/init.pp | 4 ++-- manifests/route.pp | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/alias/range.pp b/manifests/alias/range.pp index f2d93d95..96fed952 100644 --- a/manifests/alias/range.pp +++ b/manifests/alias/range.pp @@ -49,7 +49,7 @@ $states = [ '^up$', '^down$', '^absent$' ] validate_re($ensure, $states, '$ensure must be either "up", "down", or "absent".') - include 'network' + include '::network' $interface = $name $onparent = $ensure ? { diff --git a/manifests/bond/slave.pp b/manifests/bond/slave.pp index 00003e36..0bce69c2 100644 --- a/manifests/bond/slave.pp +++ b/manifests/bond/slave.pp @@ -41,7 +41,7 @@ fail("${macaddress} is not a MAC address.") } - include 'network' + include '::network' $interface = $name diff --git a/manifests/bridge.pp b/manifests/bridge.pp index 7d85c8b7..24336155 100644 --- a/manifests/bridge.pp +++ b/manifests/bridge.pp @@ -47,7 +47,7 @@ validate_bool($stp) validate_bool($ipv6init) - include 'network' + include '::network' $interface = $name $bootproto = 'none' diff --git a/manifests/bridge/dynamic.pp b/manifests/bridge/dynamic.pp index e952cc61..c2413478 100644 --- a/manifests/bridge/dynamic.pp +++ b/manifests/bridge/dynamic.pp @@ -49,7 +49,7 @@ validate_bool($userctl) validate_bool($stp) - include 'network' + include '::network' $interface = $name $ipaddress = '' diff --git a/manifests/bridge/static.pp b/manifests/bridge/static.pp index 7a2c78d2..cd4e06f7 100644 --- a/manifests/bridge/static.pp +++ b/manifests/bridge/static.pp @@ -80,7 +80,7 @@ validate_bool($ipv6init) validate_bool($ipv6peerdns) - include 'network' + include '::network' $interface = $name diff --git a/manifests/global.pp b/manifests/global.pp index 8a18230a..41570327 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -87,7 +87,7 @@ validate_bool($ipv6networking) - include 'network' + include '::network' file { 'network.sysconfig': ensure => 'present', diff --git a/manifests/init.pp b/manifests/init.pp index 6f092608..e75cd647 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -12,7 +12,7 @@ # # === Sample Usage: # -# include 'network' +# include '::network' # # === Authors: # @@ -128,7 +128,7 @@ $states = [ '^up$', '^down$' ] validate_re($ensure, $states, '$ensure must be either "up" or "down".') - include 'network' + include '::network' $interface = $name diff --git a/manifests/route.pp b/manifests/route.pp index c92422e2..95a70930 100644 --- a/manifests/route.pp +++ b/manifests/route.pp @@ -49,7 +49,7 @@ validate_array($netmask) validate_array($gateway) - include 'network' + include '::network' $interface = $name From 1650391e302119925fdad6caa5922fe5a840eac4 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Sun, 26 Apr 2015 13:32:06 -0700 Subject: [PATCH 06/10] Fix lint: variable assigned to the empty string. --- manifests/alias.pp | 6 +++--- manifests/bond/bridge.pp | 4 ++-- manifests/bond/dynamic.pp | 4 ++-- manifests/bond/slave.pp | 2 +- manifests/bond/static.pp | 16 ++++++++-------- manifests/bridge.pp | 14 +++++++------- manifests/bridge/dynamic.pp | 12 ++++++------ manifests/bridge/static.pp | 16 ++++++++-------- manifests/global.pp | 16 ++++++++-------- manifests/if/bridge.pp | 4 ++-- manifests/if/dynamic.pp | 10 +++++----- manifests/if/static.pp | 20 ++++++++++---------- manifests/init.pp | 24 ++++++++++++------------ templates/ifcfg-alias.erb | 6 +++--- templates/ifcfg-bond.erb | 2 +- templates/ifcfg-br.erb | 16 ++++++++-------- templates/ifcfg-eth.erb | 26 +++++++++++++------------- templates/network.erb | 16 ++++++++-------- 18 files changed, 107 insertions(+), 107 deletions(-) diff --git a/manifests/alias.pp b/manifests/alias.pp index 5981347d..b0174e68 100644 --- a/manifests/alias.pp +++ b/manifests/alias.pp @@ -35,9 +35,9 @@ $ensure, $ipaddress, $netmask, - $gateway = '', - $ipv6address = '', - $ipv6gateway = '', + $gateway = undef, + $ipv6address = undef, + $ipv6gateway = undef, $userctl = false ) { # Validate our data diff --git a/manifests/bond/bridge.pp b/manifests/bond/bridge.pp index 68682221..e7d215a2 100644 --- a/manifests/bond/bridge.pp +++ b/manifests/bond/bridge.pp @@ -35,8 +35,8 @@ define network::bond::bridge ( $ensure, $bridge, - $mtu = '', - $ethtool_opts = '', + $mtu = undef, + $ethtool_opts = undef, $bonding_opts = 'miimon=100' ) { # Validate our regular expressions diff --git a/manifests/bond/dynamic.pp b/manifests/bond/dynamic.pp index 996e519c..6aa1901a 100644 --- a/manifests/bond/dynamic.pp +++ b/manifests/bond/dynamic.pp @@ -32,8 +32,8 @@ # define network::bond::dynamic ( $ensure, - $mtu = '', - $ethtool_opts = '', + $mtu = undef, + $ethtool_opts = undef, $bonding_opts = 'miimon=100' ) { # Validate our regular expressions diff --git a/manifests/bond/slave.pp b/manifests/bond/slave.pp index 0bce69c2..52762f89 100644 --- a/manifests/bond/slave.pp +++ b/manifests/bond/slave.pp @@ -34,7 +34,7 @@ define network::bond::slave ( $macaddress, $master, - $ethtool_opts = '' + $ethtool_opts = undef ) { # Validate our data if ! is_mac_address($macaddress) { diff --git a/manifests/bond/static.pp b/manifests/bond/static.pp index 5c422461..7b741326 100644 --- a/manifests/bond/static.pp +++ b/manifests/bond/static.pp @@ -39,18 +39,18 @@ $ensure, $ipaddress, $netmask, - $gateway = '', - $mtu = '', - $ethtool_opts = '', + $gateway = undef, + $mtu = undef, + $ethtool_opts = undef, $bonding_opts = 'miimon=100', $peerdns = false, $ipv6init = false, - $ipv6address = '', - $ipv6gateway = '', + $ipv6address = undef, + $ipv6gateway = undef, $ipv6peerdns = false, - $dns1 = '', - $dns2 = '', - $domain = '' + $dns1 = undef, + $dns2 = undef, + $domain = undef ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] diff --git a/manifests/bridge.pp b/manifests/bridge.pp index 24336155..4f1d3fde 100644 --- a/manifests/bridge.pp +++ b/manifests/bridge.pp @@ -36,8 +36,8 @@ $userctl = false, $stp = false, $delay = '30', - $bridging_opts = '', - $ipv6init = false, + $bridging_opts = undef, + $ipv6init = false ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] @@ -51,11 +51,11 @@ $interface = $name $bootproto = 'none' - $ipaddress = '' - $netmask = '' - $gateway = '' - $ipv6address = '' - $ipv6gateway = '' + $ipaddress = undef + $netmask = undef + $gateway = undef + $ipv6address = undef + $ipv6gateway = undef $onboot = $ensure ? { 'up' => 'yes', diff --git a/manifests/bridge/dynamic.pp b/manifests/bridge/dynamic.pp index c2413478..244f79cd 100644 --- a/manifests/bridge/dynamic.pp +++ b/manifests/bridge/dynamic.pp @@ -40,7 +40,7 @@ $userctl = false, $stp = false, $delay = '30', - $bridging_opts = '' + $bridging_opts = undef ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] @@ -52,11 +52,11 @@ include '::network' $interface = $name - $ipaddress = '' - $netmask = '' - $gateway = '' - $ipv6address = '' - $ipv6gateway = '' + $ipaddress = undef + $netmask = undef + $gateway = undef + $ipv6address = undef + $ipv6gateway = undef $onboot = $ensure ? { 'up' => 'yes', diff --git a/manifests/bridge/static.pp b/manifests/bridge/static.pp index cd4e06f7..441cc2d9 100644 --- a/manifests/bridge/static.pp +++ b/manifests/bridge/static.pp @@ -51,20 +51,20 @@ $ensure, $ipaddress, $netmask, - $gateway = '', - $ipv6address = '', - $ipv6gateway = '', + $gateway = undef, + $ipv6address = undef, + $ipv6gateway = undef, $bootproto = 'static', $userctl = false, $peerdns = false, $ipv6init = false, $ipv6peerdns = false, - $dns1 = '', - $dns2 = '', - $domain = '', + $dns1 = undef, + $dns2 = undef, + $domain = undef, $stp = false, $delay = '30', - $bridging_opts = '' + $bridging_opts = undef ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] @@ -88,7 +88,7 @@ if $dns2 != '' { if $dns1 == '' { $dns1_real = $dns2 - $dns2_real = '' + $dns2_real = undef } else { $dns1_real = $dns1 $dns2_real = $dns2 diff --git a/manifests/global.pp b/manifests/global.pp index 41570327..ecfd976b 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -59,15 +59,15 @@ # Copyright (C) 2011 Mike Arnold, unless otherwise noted. # class network::global ( - $hostname = '', - $gateway = '', - $gatewaydev = '', - $ipv6gateway = '', - $ipv6defaultdev = '', - $nisdomain = '', - $vlan = '', + $hostname = undef, + $gateway = undef, + $gatewaydev = undef, + $ipv6gateway = undef, + $ipv6defaultdev = undef, + $nisdomain = undef, + $vlan = undef, $ipv6networking = false, - $nozeroconf = '' + $nozeroconf = undef ) { # Validate our data if $gateway != '' { diff --git a/manifests/if/bridge.pp b/manifests/if/bridge.pp index 74bb37ad..d045c40d 100644 --- a/manifests/if/bridge.pp +++ b/manifests/if/bridge.pp @@ -31,8 +31,8 @@ define network::if::bridge ( $ensure, $bridge, - $mtu = '', - $ethtool_opts = '' + $mtu = undef, + $ethtool_opts = undef ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] diff --git a/manifests/if/dynamic.pp b/manifests/if/dynamic.pp index a0edd50b..c66ec298 100644 --- a/manifests/if/dynamic.pp +++ b/manifests/if/dynamic.pp @@ -39,13 +39,13 @@ # define network::if::dynamic ( $ensure, - $macaddress = '', + $macaddress = undef, $bootproto = 'dhcp', $userctl = false, - $mtu = '', - $dhcp_hostname = '', - $ethtool_opts = '', - $linkdelay = '' + $mtu = undef, + $dhcp_hostname = undef, + $ethtool_opts = undef, + $linkdelay = undef ) { # Validate our regular expressions $states = [ '^up$', '^down$' ] diff --git a/manifests/if/static.pp b/manifests/if/static.pp index f4010e24..62f10b5b 100644 --- a/manifests/if/static.pp +++ b/manifests/if/static.pp @@ -51,21 +51,21 @@ $ensure, $ipaddress, $netmask, - $gateway = '', - $ipv6address = '', + $gateway = undef, + $ipv6address = undef, $ipv6init = false, - $ipv6gateway = '', - $macaddress = '', + $ipv6gateway = undef, + $macaddress = undef, $ipv6autoconf = false, $userctl = false, - $mtu = '', - $ethtool_opts = '', + $mtu = undef, + $ethtool_opts = undef, $peerdns = false, $ipv6peerdns = false, - $dns1 = '', - $dns2 = '', - $domain = '', - $linkdelay = '' + $dns1 = undef, + $dns2 = undef, + $domain = undef, + $linkdelay = undef ) { # Validate our data if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") } diff --git a/manifests/init.pp b/manifests/init.pp index e75cd647..c58af690 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -97,25 +97,25 @@ $ipaddress, $netmask, $macaddress, - $gateway = '', - $ipv6address = '', - $ipv6gateway = '', + $gateway = undef, + $ipv6address = undef, + $ipv6gateway = undef, $ipv6init = false, $ipv6autoconf = false, $bootproto = 'none', $userctl = false, - $mtu = '', - $dhcp_hostname = '', - $ethtool_opts = '', + $mtu = undef, + $dhcp_hostname = undef, + $ethtool_opts = undef, $bonding_opts = undef, $isalias = false, $peerdns = false, $ipv6peerdns = false, - $dns1 = '', - $dns2 = '', - $domain = '', - $bridge = '', - $linkdelay = '', + $dns1 = undef, + $dns2 = undef, + $domain = undef, + $bridge = undef, + $linkdelay = undef ) { # Validate our booleans validate_bool($userctl) @@ -136,7 +136,7 @@ if $dns2 != '' { if $dns1 == '' { $dns1_real = $dns2 - $dns2_real = '' + $dns2_real = undef } else { $dns1_real = $dns1 $dns2_real = $dns2 diff --git a/templates/ifcfg-alias.erb b/templates/ifcfg-alias.erb index 8f9c6039..7ae1cd4b 100644 --- a/templates/ifcfg-alias.erb +++ b/templates/ifcfg-alias.erb @@ -5,11 +5,11 @@ DEVICE=<%= @interface %> BOOTPROTO=<%= @bootproto %> ONPARENT=<%= @onparent %> TYPE=Ethernet -<% if !@ipaddress.empty? %>IPADDR=<%= @ipaddress %> +<% if @ipaddress %>IPADDR=<%= @ipaddress %> <% end -%> -<% if !@netmask.empty? %>NETMASK=<%= @netmask %> +<% if @netmask %>NETMASK=<%= @netmask %> <% end -%> -<% if !@gateway.empty? %>GATEWAY=<%= @gateway %> +<% if @gateway %>GATEWAY=<%= @gateway %> <% end -%> <% if @userctl %>USERCTL=yes <% end -%> diff --git a/templates/ifcfg-bond.erb b/templates/ifcfg-bond.erb index eaeb2add..91f5952a 100644 --- a/templates/ifcfg-bond.erb +++ b/templates/ifcfg-bond.erb @@ -6,6 +6,6 @@ HWADDR=<%= @macaddress %> MASTER=<%= @master %> SLAVE=yes TYPE=Ethernet -<% if !@ethtool_opts.empty? %>ETHTOOL_OPTS="<%= @ethtool_opts %>" +<% if @ethtool_opts %>ETHTOOL_OPTS="<%= @ethtool_opts %>" <% end -%> NM_CONTROLLED=no diff --git a/templates/ifcfg-br.erb b/templates/ifcfg-br.erb index c7b4b6eb..41fe84d1 100644 --- a/templates/ifcfg-br.erb +++ b/templates/ifcfg-br.erb @@ -5,27 +5,27 @@ DEVICE=<%= @interface %> BOOTPROTO=<%= @bootproto %> ONBOOT=<%= @onboot %> TYPE=Bridge -<% if !@ipaddress.empty? %>IPADDR=<%= @ipaddress %> +<% if @ipaddress %>IPADDR=<%= @ipaddress %> <% end -%> -<% if !@netmask.empty? %>NETMASK=<%= @netmask %> +<% if @netmask %>NETMASK=<%= @netmask %> <% end -%> -<% if !@gateway.empty? %>GATEWAY=<%= @gateway %> +<% if @gateway %>GATEWAY=<%= @gateway %> <% end -%> <% if @ipv6init %>IPV6INIT=yes -<% if !@ipv6address.empty? %>IPV6ADDR=<%= @ipv6address %> +<% if @ipv6address %>IPV6ADDR=<%= @ipv6address %> <% end -%> -<% if !@ipv6gateway.empty? %>IPV6_DEFAULTGW=<%= @ipv6gateway %> +<% if @ipv6gateway %>IPV6_DEFAULTGW=<%= @ipv6gateway %> <% end -%> <% if @ipv6peerdns %>IPV6_PEERDNS=yes <% end -%> <% end -%> <% if !@peerdns %>PEERDNS=no <% else %>PEERDNS=yes -<% if !@dns1_real.empty? %>DNS1=<%= @dns1_real %> +<% if @dns1_real %>DNS1=<%= @dns1_real %> <% end -%> -<% if !@dns2_real.empty? %>DNS2=<%= @dns2_real %> +<% if @dns2_real %>DNS2=<%= @dns2_real %> <% end -%> -<% if !@domain.empty? %>DOMAIN="<%= @domain %>" +<% if @domain %>DOMAIN="<%= @domain %>" <% end -%> <% end -%> <% if @userctl %>USERCTL=yes diff --git a/templates/ifcfg-eth.erb b/templates/ifcfg-eth.erb index 1940e101..42b2065b 100644 --- a/templates/ifcfg-eth.erb +++ b/templates/ifcfg-eth.erb @@ -3,32 +3,32 @@ ### DEVICE=<%= @interface %> BOOTPROTO=<%= @bootproto %> -<% if !@macaddress.empty? %>HWADDR=<%= @macaddress %> +<% if @macaddress %>HWADDR=<%= @macaddress %> <% end -%> ONBOOT=<%= @onboot %> HOTPLUG=<%= @onboot %> TYPE=Ethernet -<% if !@ipaddress.empty? %>IPADDR=<%= @ipaddress %> +<% if @ipaddress %>IPADDR=<%= @ipaddress %> <% end -%> -<% if !@netmask.empty? %>NETMASK=<%= @netmask %> +<% if @netmask %>NETMASK=<%= @netmask %> <% end -%> -<% if !@gateway.empty? %>GATEWAY=<%= @gateway %> +<% if @gateway %>GATEWAY=<%= @gateway %> <% end -%> -<% if !@mtu.empty? %>MTU=<%= @mtu %> +<% if @mtu %>MTU=<%= @mtu %> <% end -%> <% if @bonding_opts %>BONDING_OPTS="<%= @bonding_opts %>" <% end -%> <% if @dhcp_hostname %>DHCP_HOSTNAME="<%= @dhcp_hostname %>" <% end -%> -<% if !@ethtool_opts.empty? %>ETHTOOL_OPTS="<%= @ethtool_opts %>" +<% if @ethtool_opts %>ETHTOOL_OPTS="<%= @ethtool_opts %>" <% end -%> <% if !@peerdns %>PEERDNS=no <% else %>PEERDNS=yes -<% if !@dns1_real.empty? %>DNS1=<%= @dns1_real %> +<% if @dns1_real %>DNS1=<%= @dns1_real %> <% end -%> -<% if !@dns2_real.empty? %>DNS2=<%= @dns2_real %> +<% if @dns2_real %>DNS2=<%= @dns2_real %> <% end -%> -<% if !@domain.empty? %>DOMAIN="<%= @domain %>" +<% if @domain %>DOMAIN="<%= @domain %>" <% end -%> <% end -%> <% if @userctl %>USERCTL=yes @@ -38,16 +38,16 @@ IPV6INIT=yes <% if !@ipv6autoconf %>IPV6_AUTOCONF=no <% else %>IPV6_AUTOCONF=yes <% end -%> -<% if !@ipv6address.empty? %>IPV6ADDR=<%= @ipv6address %> +<% if @ipv6address %>IPV6ADDR=<%= @ipv6address %> <% end -%> -<% if !@ipv6gateway.empty? %>IPV6_DEFAULTGW=<%= @ipv6gateway %> +<% if @ipv6gateway %>IPV6_DEFAULTGW=<%= @ipv6gateway %> <% end -%> <% if !@ipv6peerdns %>IPV6_PEERDNS=no <% else %>IPV6_PEERDNS=yes <% end -%> <% end -%> -<% if !@bridge.empty? %>BRIDGE=<%= @bridge %> +<% if @bridge %>BRIDGE=<%= @bridge %> <% end -%> -<% if !@linkdelay.empty? %>LINKDELAY=<%= @linkdelay %> +<% if @linkdelay %>LINKDELAY=<%= @linkdelay %> <% end -%> NM_CONTROLLED=no diff --git a/templates/network.erb b/templates/network.erb index 6ff541b7..25805399 100644 --- a/templates/network.erb +++ b/templates/network.erb @@ -4,21 +4,21 @@ NETWORKING=yes <% if !@ipv6networking %>NETWORKING_IPV6=no <% else %>NETWORKING_IPV6=yes -<% if !@ipv6gateway.empty? %>IPV6_DEFAULTGW=<%= @ipv6gateway %> +<% if @ipv6gateway %>IPV6_DEFAULTGW=<%= @ipv6gateway %> <% end -%> -<% if !@ipv6defaultdev.empty? %>IPV6_DEFAULTDEV=<%= @ipv6defaultdev %> +<% if @ipv6defaultdev %>IPV6_DEFAULTDEV=<%= @ipv6defaultdev %> <% end -%> <% end -%> -<% if !@hostname.empty? %>HOSTNAME=<%= @hostname %> +<% if @hostname %>HOSTNAME=<%= @hostname %> <% else %>HOSTNAME=<%= scope.lookupvar('::fqdn') %> <% end -%> -<% if !@gateway.empty? %>GATEWAY=<%= @gateway %> +<% if @gateway %>GATEWAY=<%= @gateway %> <% end -%> -<% if !@gatewaydev.empty? %>GATEWAYDEV=<%= @gatewaydev %> +<% if @gatewaydev %>GATEWAYDEV=<%= @gatewaydev %> <% end -%> -<% if !@nisdomain.empty? %>NISDOMAIN=<%= @nisdomain %> +<% if @nisdomain %>NISDOMAIN=<%= @nisdomain %> <% end -%> -<% if !@vlan.empty? %>VLAN=<%= @vlan %> +<% if @vlan %>VLAN=<%= @vlan %> <% end -%> -<% if !@nozeroconf.empty? %>NOZEROCONF=<%= @nozeroconf %> +<% if @nozeroconf %>NOZEROCONF=<%= @nozeroconf %> <% end -%> From cb6047b00e50bcfc3b9f46fbecea770a9d31d65d Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Sun, 26 Apr 2015 13:58:18 -0700 Subject: [PATCH 07/10] Clean up conditional logic around empty strings. Should fix Travis job#100. --- manifests/bond/static.pp | 2 +- manifests/bridge/static.pp | 6 +++--- manifests/global.pp | 6 +++--- manifests/if/static.pp | 2 +- manifests/init.pp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifests/bond/static.pp b/manifests/bond/static.pp index 7b741326..593756c7 100644 --- a/manifests/bond/static.pp +++ b/manifests/bond/static.pp @@ -57,7 +57,7 @@ validate_re($ensure, $states, '$ensure must be either "up" or "down".') # Validate our data if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") } - if $ipv6address != '' { + if $ipv6address { if ! is_ip_address($ipv6address) { fail("${ipv6address} is not an IPv6 address.") } } # Validate booleans diff --git a/manifests/bridge/static.pp b/manifests/bridge/static.pp index 441cc2d9..23c5e5bc 100644 --- a/manifests/bridge/static.pp +++ b/manifests/bridge/static.pp @@ -71,7 +71,7 @@ validate_re($ensure, $states, '$ensure must be either "up" or "down".') # Validate our data if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") } - if $ipv6address != '' { + if $ipv6address { if ! is_ip_address($ipv6address) { fail("${ipv6address} is not an IPv6 address.") } } # Validate booleans @@ -85,8 +85,8 @@ $interface = $name # Deal with the case where $dns2 is non-empty and $dns1 is empty. - if $dns2 != '' { - if $dns1 == '' { + if $dns2 { + if !$dns1 { $dns1_real = $dns2 $dns2_real = undef } else { diff --git a/manifests/global.pp b/manifests/global.pp index ecfd976b..edbe0118 100644 --- a/manifests/global.pp +++ b/manifests/global.pp @@ -70,17 +70,17 @@ $nozeroconf = undef ) { # Validate our data - if $gateway != '' { + if $gateway { if ! is_ip_address($gateway) { fail("${gateway} is not an IP address.") } } - if $ipv6gateway != '' { + if $ipv6gateway { if ! is_ip_address($ipv6gateway) { fail("${ipv6gateway} is not an IPv6 address.") } } validate_bool($ipv6networking) # Validate our regular expressions - if $vlan != '' { + if $vlan { $states = [ '^yes$', '^no$' ] validate_re($vlan, $states, '$vlan must be either "yes" or "no".') } diff --git a/manifests/if/static.pp b/manifests/if/static.pp index 62f10b5b..4a47cbb7 100644 --- a/manifests/if/static.pp +++ b/manifests/if/static.pp @@ -69,7 +69,7 @@ ) { # Validate our data if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") } - if $ipv6address != '' { + if $ipv6address { if ! is_ip_address($ipv6address) { fail("${ipv6address} is not an IPv6 address.") } } diff --git a/manifests/init.pp b/manifests/init.pp index c58af690..65bd4b2f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -133,8 +133,8 @@ $interface = $name # Deal with the case where $dns2 is non-empty and $dns1 is empty. - if $dns2 != '' { - if $dns1 == '' { + if $dns2 { + if !$dns1 { $dns1_real = $dns2 $dns2_real = undef } else { From ebdefa4a6aef77850bc58a0c8d71ecac430e0c0a Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Mon, 27 Apr 2015 23:01:59 -0700 Subject: [PATCH 08/10] Unit test against Puppet 4 via modulesync. --- .travis.yml | 11 +---------- Gemfile | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91c42402..802509d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,9 @@ matrix: env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 4.0" - allow_failures: - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" + env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.5 env: PUPPET_GEM_VERSION="~> 4.0" notifications: email: diff --git a/Gemfile b/Gemfile index c01e9721..ac26c20c 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :unit_tests do gem 'rake', :require => false gem 'rspec', '~> 2.0', :require => false - gem 'rspec-puppet', '~> 2.0', :require => false + gem 'rspec-puppet', '>= 2.1.0', :require => false gem 'puppetlabs_spec_helper', :require => false gem 'puppet-lint', '>= 1.1.0', :require => false gem 'simplecov', :require => false From 25670840e2ba66cf1b6d91d8119aeef146b4ada8 Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 4 Jun 2015 23:34:35 -0700 Subject: [PATCH 09/10] Now supporting Puppet 4. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 8a49fbe9..fb3f988a 100644 --- a/metadata.json +++ b/metadata.json @@ -39,7 +39,7 @@ }, { "name": "puppet", - "version_requirement": ">=2.7.20 <4.0.0" + "version_requirement": ">=2.7.20 <5.0.0" } ] } From 62e9968147dec78e55d8c9f2f93513ffdb7c205e Mon Sep 17 00:00:00 2001 From: Michael Arnold Date: Thu, 4 Jun 2015 23:38:08 -0700 Subject: [PATCH 10/10] Update versions for 3.5.0 release. --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index fb3f988a..5b946583 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "razorsedge-network", - "version": "3.4.0", + "version": "3.5.0", "author": "razorsedge", "summary": "Manage RedHat traditional network configuration via static and dhcp configuration of normal and bonded interfaces as well as bridges and VLANs.", "license": "Apache-2.0",