def delete
debug 'Deleting rule %s' % resource[:name]
- iptables "-D", properties[:chain], properties[:rulenum]
+ iptables "-D", properties[:chain], insert_order
end
def exists?
def update_args
args = []
- args << ["-R", resource[:chain], properties[:rulenum]]
+ args << ["-R", resource[:chain], insert_order]
args << general_args
args
end
@@resource_list.each do |res|
if(resource.value(res))
args << @@resource_map[res].split(' ')
- args << resource[res]
+ if resource[res].is_a?(Array)
+ args << resource[res].join(',')
+ else
+ args << resource[res]
+ end
end
end
args
Accepts a single string or array."
end
- newproperty(:sport) do
+ newproperty(:sport, :array_matching => :all) do
desc "The value for the iptables --source-port parameter.
If an array is specified, values will be passed to multiport module."
munge do |value|
@resource.string_to_port(value)
end
+
+ def value_to_s(value)
+ value = [value] unless value.is_a?(Array)
+ value.join(',')
+ end
+
+ def change_to_s(currentvalue, newvalue)
+ currentvalue = value_to_s(currentvalue) if currentvalue != :absent
+ newvalue = value_to_s(newvalue)
+ super(currentvalue, newvalue)
+ end
end
newproperty(:dport, :array_matching => :all) do