fix ipv4 cidr range regexp
This commit is contained in:
parent
3bb769bd30
commit
377b5b4f18
@ -10,7 +10,7 @@ Puppet::Type.newtype(:nova_network) do
|
||||
# that determine uniqueness
|
||||
newparam(:network, :namevar => true) do
|
||||
desc "IPv4 Network (ie, 192.168.1.0/24)"
|
||||
newvalues(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.0\/[0-9]{1,2}$/)
|
||||
newvalues(/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/(\d|[1-2]\d|3[0-2]))$/)
|
||||
end
|
||||
|
||||
newparam(:label) do
|
||||
|
11
spec/unit/type/nova_network_spec.rb
Normal file
11
spec/unit/type/nova_network_spec.rb
Normal file
@ -0,0 +1,11 @@
|
||||
require 'puppet'
|
||||
require 'puppet/type/nova_network'
|
||||
describe 'Puppet::Type.type(:nova_network)' do
|
||||
it 'should reject an invalid ipv4 CIDR value' do
|
||||
expect { Puppet::Type.type(:nova_network).new(:network => '192.168.1.0') }.to raise_error(Puppet::Error, /Invalid value/)
|
||||
expect { Puppet::Type.type(:nova_network).new(:network => '::1/24') }.to raise_error(Puppet::Error, /Invalid value/)
|
||||
end
|
||||
it 'should accept a valid ipv4 CIDR value' do
|
||||
Puppet::Type.type(:nova_network).new(:network => '192.168.1.0/24')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user