Skip to content

Commit

Permalink
Merge pull request voxpupuli#47 from jhoblitt/redhat_provider_tagged_…
Browse files Browse the repository at this point in the history
…interfaces

Redhat provider tagged interfaces
  • Loading branch information
adrienthebo committed Jul 11, 2013
2 parents 0522487 + 66f66cc commit f01aa12
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/puppet/provider/network_config/redhat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
# @return [String] The path to network-script directory on redhat systems
SCRIPT_DIRECTORY = "/etc/sysconfig/network-scripts"

# The valid vlan ID range is 0-4095; 4096 is out of range
vlan_range_regex = %r[\d{1,3}|40[0-9][0-5]]

# @return [Regexp] The regular expression for interface scripts on redhat systems
SCRIPT_REGEX = %r[\Aifcfg-[a-z]+\d+(?::\d)?\Z]
SCRIPT_REGEX = %r[\Aifcfg-[a-z]+\d+(?::\d+|\.#{vlan_range_regex})?\Z]

NAME_MAPPINGS = {
:ipaddress => 'IPADDR',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEVICE="eth0.0"
VLAN="yes"
BOOTPROTO="none"
IPV6INIT="no"
MTU="9000"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE="br1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEVICE="eth0.1"
VLAN="yes"
BOOTPROTO="none"
IPV6INIT="no"
MTU="9000"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE="br1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEVICE="eth0.4095"
VLAN="yes"
BOOTPROTO="none"
IPV6INIT="no"
MTU="9000"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE="br4095"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEVICE="eth0.4096"
VLAN="yes"
BOOTPROTO="none"
IPV6INIT="no"
MTU="9000"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
BRIDGE="br4095"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
DEVICE="eth0:10000000"
IPADDR="10.10.10.10"
NETMASK="255.255.255.0"
BOOTPROTO="none"
IPV6INIT="no"
MTU="9000"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
6 changes: 4 additions & 2 deletions spec/unit/provider/network_config/redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ def fixture_data(file)

valid_files = %w[ifcfg-bond0 ifcfg-bond1 ifcfg-eth0 ifcfg-eth1 ifcfg-eth2
ifcfg-eth3 ifcfg-vlan100 ifcfg-vlan100:0 ifcfg-vlan200
ifcfg-vlan300 ifcfg-vlan400 ifcfg-vlan500]
ifcfg-vlan300 ifcfg-vlan400 ifcfg-vlan500 ifcfg-eth0.0
ifcfg-eth0.1 ifcfg-eth0.4095 ifcfg-eth0:10000000]

invalid_files = %w[.ifcfg-bond0.swp ifcfg-bond1~ ifcfg-vlan500.bak]
invalid_files = %w[.ifcfg-bond0.swp ifcfg-bond1~ ifcfg-vlan500.bak
ifcfg-eth0.4096]

valid_files.each do |file|
it { should be_include file }
Expand Down

0 comments on commit f01aa12

Please sign in to comment.