Merge pull request #20762 from jfindlay/fix_nftables

fix nftables.get_rule_handle return error
This commit is contained in:
Thomas S Hatch 2015-02-17 13:01:39 -07:00
commit 5ad79aec76

View File

@ -378,11 +378,11 @@ def get_rule_handle(table='filter', chain=None, rule=None, family='ipv4'):
rules = re.split('\n+', out)
pat = re.compile(r'{0} # handle (?P<handle>\d+)'.format(rule))
for rule in rules:
match = pat.search(rule)
for r in rules:
match = pat.search(r)
if match:
handle = match.group('handle')
return handle
return match.group('handle')
return 'Error: could not find rule {0}'.format(rule)
def check(table='filter', chain=None, rule=None, family='ipv4'):