Skip to content

Commit a393189

Browse files
authored
Merge pull request #248 from KeithWard/fix_invalid_vlan_regex
Correct VLAN_RANGE_REGEX.
2 parents 85dafc4 + 6423c7c commit a393189

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/puppet/provider/network_config/redhat.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SCRIPT_DIRECTORY = '/etc/sysconfig/network-scripts'.freeze
2323

2424
# The valid vlan ID range is 0-4095; 4096 is out of range
25-
VLAN_RANGE_REGEX = %r{\d{1,3}|40[0-9][0-5]}
25+
VLAN_RANGE_REGEX = %r{[1-3]?\d{1,3}|40[0-8]\d|409[0-5]}
2626

2727
# @return [Regexp] The regular expression for interface scripts on redhat systems
2828
SCRIPT_REGEX = %r{\Aifcfg-[a-z]+[a-z\d]+(?::\d+|\.#{VLAN_RANGE_REGEX})?\Z}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
VLAN=yes
2+
DEVICE=bond1.1001
3+
BOOTPROTO=static
4+
NETMASK=255.255.255.0
5+
IPADDR=172.24.66.1

spec/unit/provider/network_config/redhat_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def fixture_data(file)
3030
valid_files = %w[ifcfg-bond0 ifcfg-bond1 ifcfg-eth0 ifcfg-eth1 ifcfg-eth2
3131
ifcfg-eth3 ifcfg-vlan100 ifcfg-vlan100:0 ifcfg-vlan200
3232
ifcfg-vlan300 ifcfg-vlan400 ifcfg-vlan500 ifcfg-eth0.0
33-
ifcfg-eth0.1 ifcfg-eth0.4095 ifcfg-eth0:10000000]
33+
ifcfg-eth0.1 ifcfg-eth0.4095 ifcfg-eth0:10000000
34+
ifcfg-bond1.1001]
3435

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

0 commit comments

Comments
 (0)