desc "The value for the iptables --icmp-type parameter"
munge do |value|
- num = @resource.icmp_name_to_number(value)
- if num == nil && value != ""
+ if value.kind_of?(String)
+ value = @resource.icmp_name_to_number(value)
+ else
+ value
+ end
+
+ if value == nil && value != ""
self.fail("cannot work out icmp type")
end
- num
+ value
end
end
end
end
+ it 'should accept values as integers' do
+ @resource[:icmp] = 9
+ @resource[:icmp].should == 9
+ end
+
it 'should fail if icmp type is not recognized' do
lambda { @resource[:icmp] = 'foo' }.should raise_error(Puppet::Error)
end