-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Puppet 4 and 5 #148
base: develop
Are you sure you want to change the base?
Changes from 40 commits
497078b
12d3127
4f90844
81cb363
9505bed
3e67b7a
11fcab2
d68acaa
d5e3b71
62e3a94
674be8e
a63a23d
7b83769
4d7f15d
046a380
7c8e5b3
2b7d2f6
11de7c1
0e95a0c
522959e
6fef947
43b3bc8
2131838
335a120
020ef28
9cc223b
5f38177
7bcb6b8
220aa34
4fc403b
03c72f5
0834c90
4b69dde
44b0ef4
086ed5c
81c922c
a2e133b
7db97fa
647e94f
86a4349
c3c6b44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
fixtures: | ||
repositories: | ||
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
stdlib: | ||
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' | ||
ref: '4.24.0' | ||
ip: | ||
repo: 'https://github.com/thrnio/puppet-ip.git' | ||
ref: 'v1.0.0' | ||
symlinks: | ||
network: "#{source_dir}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,25 +14,10 @@ script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake | |
matrix: | ||
fast_finish: true | ||
include: | ||
- rvm: 1.8.7 | ||
env: PUPPET_GEM_VERSION="~> 3.0" | ||
- rvm: 1.9.3 | ||
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.9 | ||
env: PUPPET_GEM_VERSION="~> 4.0" | ||
- rvm: 2.4.1 | ||
env: PUPPET_GEM_VERSION="~> 5.0" | ||
- rvm: 1.8.7 | ||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" | ||
- rvm: 1.8.7 | ||
env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" | ||
allow_failures: | ||
- rvm: 2.4.1 | ||
env: PUPPET_GEM_VERSION="~> 5.0" | ||
notifications: | ||
email: | ||
- [email protected] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,28 +38,16 @@ | |
# Copyright (C) 2013 Mike Arnold, unless otherwise noted. | ||
# | ||
define network::alias::range ( | ||
$ensure, | ||
$ipaddress_start, | ||
$ipaddress_end, | ||
$clonenum_start, | ||
$noaliasrouting = false, | ||
$restart = true, | ||
$netmask = false, | ||
$broadcast = false, | ||
$arpcheck = true, | ||
Enum['up', 'down', 'absent'] $ensure, | ||
IP::Address::V4::NoSubnet $ipaddress_start, | ||
IP::Address::V4::NoSubnet $ipaddress_end, | ||
String $clonenum_start, | ||
Boolean $noaliasrouting = false, | ||
Boolean $restart = true, | ||
Optional[IP::Address::V4::NoSubnet] $netmask = undef, | ||
Optional[IP::Address::V4::NoSubnet] $broadcast = undef, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Previous default values were misleading, and keeping them would make us accept Boolean for these parameters (doesn't sound like a good idea). This change has no impact on the way templates use the data. |
||
Boolean $arpcheck = true, | ||
) { | ||
# Validate our data | ||
if ! is_ip_address($ipaddress_start) { fail("${ipaddress_start} is not an IP address.") } | ||
if ! is_ip_address($ipaddress_end) { fail("${ipaddress_end} is not an IP address.") } | ||
if $netmask and !is_ip_address($netmask) { fail("${netmask} is not an IP address.") } | ||
if $broadcast and !is_ip_address($broadcast) { fail("${broadcast} is not an IP address.") } | ||
# Validate our booleans | ||
validate_bool($noaliasrouting) | ||
validate_bool($restart) | ||
validate_bool($arpcheck) | ||
# Validate our regular expressions | ||
$states = [ '^up$', '^down$', '^absent$' ] | ||
validate_re($ensure, $states, '$ensure must be either "up", "down", or "absent".') | ||
|
||
include '::network' | ||
|
||
|
@@ -82,7 +70,16 @@ | |
owner => 'root', | ||
group => 'root', | ||
path => "/etc/sysconfig/network-scripts/ifcfg-${interface}-range${clonenum_start}", | ||
content => template('network/ifcfg-alias-range.erb'), | ||
content => epp("${module_name}/ifcfg-alias-range.epp", { | ||
ipaddress_start => $ipaddress_start, | ||
ipaddress_end => $ipaddress_end, | ||
clonenum_start => $clonenum_start, | ||
noaliasrouting => $noaliasrouting, | ||
netmask => $netmask, | ||
broadcast => $broadcast, | ||
arpcheck => $arpcheck, | ||
onparent => $onparent, | ||
}), | ||
before => File["ifcfg-${interface}"], | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,26 +32,17 @@ | |
# Copyright (C) 2015 Jason Vervlied, unless otherwise noted. | ||
# | ||
define network::bond ( | ||
$ensure, | ||
$mtu = undef, | ||
$ethtool_opts = undef, | ||
$bonding_opts = 'miimon=100', | ||
$zone = undef, | ||
$restart = true, | ||
Enum['up', 'down'] $ensure, | ||
Optional[String] $mtu = undef, | ||
Optional[String] $ethtool_opts = undef, | ||
String $bonding_opts = 'miimon=100', | ||
Optional[String] $zone = undef, | ||
Boolean $restart = true, | ||
) { | ||
# Validate our regular expressions | ||
$states = [ '^up$', '^down$' ] | ||
validate_re($ensure, $states, '$ensure must be either "up" or "down".') | ||
|
||
network_if_base { $title: | ||
ensure => $ensure, | ||
ipaddress => '', | ||
netmask => '', | ||
gateway => '', | ||
macaddress => '', | ||
bootproto => 'none', | ||
ipv6address => '', | ||
ipv6gateway => '', | ||
mtu => $mtu, | ||
ethtool_opts => $ethtool_opts, | ||
bonding_opts => $bonding_opts, | ||
|
@@ -61,10 +52,10 @@ | |
|
||
# Only install "alias bondN bonding" on old OSs that support | ||
# /etc/modprobe.conf. | ||
case $::operatingsystem { | ||
case $::os['name'] { | ||
/^(RedHat|CentOS|OEL|OracleLinux|SLC|Scientific)$/: { | ||
case $::operatingsystemrelease { | ||
/^[45]/: { | ||
case $::os['release']['major'] { | ||
/^[45]$/: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switched to major release, as only the "major" part was used. |
||
augeas { "modprobe.conf_${title}": | ||
context => '/files/etc/modprobe.conf', | ||
changes => [ | ||
|
@@ -79,7 +70,7 @@ | |
} | ||
} | ||
'Fedora': { | ||
case $::operatingsystemrelease { | ||
case $::os['release']['major'] { | ||
/^(1|2|3|4|5|6|7|8|9|10|11)$/: { | ||
augeas { "modprobe.conf_${title}": | ||
context => '/files/etc/modprobe.conf', | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expect this module to work on >=4.x but I am not sure what is the best method to validate this belief.