This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For iptables the format must be {chain}:{table}:{protocol}.
EOS
isnamevar
validatedo |value|
ifvalue !~ Nameformatthen
raiseArgumentError,"Inbuilt chains must be in the form {chain}:{table}:{protocol} where {table} is one of FILTER, NAT, MANGLE, RAW, RAWPOST, BROUTE or empty (alias for filter), chain can be anything without colons or one of PREROUTING, POSTROUTING, BROUTING, INPUT, FORWARD, OUTPUT for the inbuilt chains, and {protocol} being IPv4, IPv6, ethernet (ethernet bridging) got '#{value}' table:'#{$1}' chain:'#{$2}' protocol:'#{$3}'"
else
chain= $1
table= $2
protocol= $3
casetable
when'filter'
ifchain =~ /^(PREROUTING|POSTROUTING|BROUTING)$/
raiseArgumentError,"INPUT, OUTPUT and FORWARD are the only inbuilt chains that can be used in table 'filter'"
end
when'mangle'
ifchain =~ InternalChains && chain == 'BROUTING'
raiseArgumentError,"PREROUTING, POSTROUTING, INPUT, FORWARD and OUTPUT are the only inbuilt chains that can be used in table 'mangle'"
end
when'nat'
ifchain =~ /^(BROUTING|INPUT|FORWARD)$/
raiseArgumentError,"PREROUTING, POSTROUTING and OUTPUT are the only inbuilt chains that can be used in table 'nat'"
end
ifprotocol =~/^(IP(v6)?)?$/
raiseArgumentError,"table nat isn't valid in IPv6. You must specify ':IPv4' as the name suffix"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it"should be nil for zero prefix length address #{prefix}"do
@resource[addr]=prefix
@resource[addr].should == nil
end
end
end
end
Expand All
@@ -131,6 +140,11 @@
@resource[port].should == ['22','23']
end
it"should accept a #{port} as a number"do
@resource[port]=22
@resource[port].should == ['22']
end
it"should accept a #{port} as a hyphen separated range"do
@resource[port]=['22-1000']
@resource[port].should == ['22-1000']
Expand All
@@ -149,11 +163,11 @@
end
it"should not accept something invalid for #{port}"do
expect{@resource[port]='something odd'}.shouldraise_error(Puppet::Error,/^Parameter .+ failed: Munging failed for value ".+" in class .+: no such service/)
expect{@resource[port]='something odd'}.toraise_error(Puppet::Error,/^Parameter .+ failed.+Munging failed for value ".+" in class .+: no such service/)
end
it"should not accept something invalid in an array for #{port}"do
expect{@resource[port]=['something odd','something even odder']}.shouldraise_error(Puppet::Error,/^Parameter .+ failed: Munging failed for value ".+" in class .+: no such service/)
expect{@resource[port]=['something odd','something even odder']}.toraise_error(Puppet::Error,/^Parameter .+ failed.+Munging failed for value ".+" in class .+: no such service/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters