Merge pull request #23996 from neogenix/2015.5-23950

iptables state generates a 0 position which is invalid in iptables cli #23950
This commit is contained in:
Nicole Thomas 2015-05-20 16:44:27 -06:00
commit 17b7c0b741

View file

@ -732,6 +732,8 @@ def insert(table='filter', chain=None, position=None, rule=None, family='ipv4'):
rules = get_rules(family='ipv4')
size = len(rules[table][chain]['rules'])
position = (size + position) + 1
if position is 0:
position = 1
wait = '--wait' if _has_option('--wait', family) else ''
cmd = '{0} {1} -t {2} -I {3} {4} {5}'.format(