Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rwf14f committed Jun 23, 2015
2 parents 41b2dc4 + 4f8a6f4 commit cc06aa4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,4 @@ matrix:
- rvm: 2.1.0
env: PUPPET_GEM_VERSION="~> 4.0"
notifications:
email:
- github@razorsedge.org
email: false
51 changes: 30 additions & 21 deletions manifests/if/static.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
# domain => 'is.domain.com domain.com',
# ipv6init => true,
# ipv6address => '123:4567:89ab:cdef:123:4567:89ab:cdef'
# ipv6gateway => '123:4567:89ab:cdef:123:4567:89ab:1'
# ipv6gateway => '123:4567:89ab:cdef:123:4567:89ab:1'
# }
#
# === Authors:
Expand Down Expand Up @@ -69,8 +69,16 @@
) {
# Validate our data
if ! is_ip_address($ipaddress) { fail("${ipaddress} is not an IP address.") }
if $ipv6address {
if is_array($ipv6address) {
if size($ipv6address) > 0 {
validate_ip_address { $ipv6address: }
$primary_ipv6address = $ipv6address[0]
$secondary_ipv6addresses = delete_at($ipv6address, 0)
}
} elsif $ipv6address {
if ! is_ip_address($ipv6address) { fail("${ipv6address} is not an IPv6 address.") }
$primary_ipv6address = $ipv6address
$secondary_ipv6addresses = undef
}

if ! is_mac_address($macaddress) {
Expand All @@ -88,24 +96,25 @@
validate_bool($ipv6peerdns)

network_if_base { $title:
ensure => $ensure,
ipv6init => $ipv6init,
ipaddress => $ipaddress,
ipv6address => $ipv6address,
netmask => $netmask,
gateway => $gateway,
ipv6gateway => $ipv6gateway,
ipv6autoconf => $ipv6autoconf,
macaddress => $macaddy,
bootproto => 'none',
userctl => $userctl,
mtu => $mtu,
ethtool_opts => $ethtool_opts,
peerdns => $peerdns,
ipv6peerdns => $ipv6peerdns,
dns1 => $dns1,
dns2 => $dns2,
domain => $domain,
linkdelay => $linkdelay,
ensure => $ensure,
ipv6init => $ipv6init,
ipaddress => $ipaddress,
ipv6address => $primary_ipv6address,
netmask => $netmask,
gateway => $gateway,
ipv6gateway => $ipv6gateway,
ipv6autoconf => $ipv6autoconf,
ipv6secondaries => $secondary_ipv6addresses,
macaddress => $macaddy,
bootproto => 'none',
userctl => $userctl,
mtu => $mtu,
ethtool_opts => $ethtool_opts,
peerdns => $peerdns,
ipv6peerdns => $ipv6peerdns,
dns1 => $dns1,
dns2 => $dns2,
domain => $domain,
linkdelay => $linkdelay,
}
} # define network::if::static
22 changes: 22 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
$ipv6gateway = undef,
$ipv6init = false,
$ipv6autoconf = false,
$ipv6secondaries = undef,
$bootproto = 'none',
$userctl = false,
$mtu = undef,
Expand Down Expand Up @@ -172,3 +173,24 @@
notify => Service['network'],
}
} # define network_if_base

# == Definition: validate_ip_address
#
# This definition can be used to call is_ip_address on an array of ip addresses.
#
# === Parameters:
#
# None
#
# === Actions:
#
# Runs is_ip_address on the name of the define and fails if it is not a valid IP address.
#
# === Sample Usage:
#
# $ips = [ '10.21.30.248', '123:4567:89ab:cdef:123:4567:89ab:cdef' ]
# validate_ip_address { $ips: }
#
define validate_ip_address {
if ! is_ip_address($name) { fail("${name} is not an IP(v6) address.") }
} # define validate_ip_address
2 changes: 2 additions & 0 deletions templates/ifcfg-eth.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ IPV6INIT=yes
<% if !@ipv6peerdns %>IPV6_PEERDNS=no
<% else %>IPV6_PEERDNS=yes
<% end -%>
<% if @ipv6secondaries and @ipv6secondaries.length > 0 %>IPV6ADDR_SECONDARIES="<%= @ipv6secondaries.join(' ') %>"
<% end -%>
<% end -%>
<% if @bridge %>BRIDGE=<%= @bridge %>
<% end -%>
Expand Down

0 comments on commit cc06aa4

Please sign in to comment.