mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #23513 from gladiatr72/RFC_stop_iptables.check_from_short-circuiting_position-only_delete_rule
short-circuit auto-failure of iptables.delete state
This commit is contained in:
commit
c3f03d827d
1 changed files with 8 additions and 6 deletions
|
@ -601,16 +601,18 @@ def delete(name, family='ipv4', **kwargs):
|
|||
kwargs['name'] = name
|
||||
rule = __salt__['iptables.build_rule'](family=family, **kwargs)
|
||||
command = __salt__['iptables.build_rule'](full=True, family=family, command='D', **kwargs)
|
||||
|
||||
if not __salt__['iptables.check'](kwargs['table'],
|
||||
kwargs['chain'],
|
||||
rule,
|
||||
family) is True:
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'iptables rule for {0} already absent for {1} ({2})'.format(
|
||||
name,
|
||||
family,
|
||||
command.strip())
|
||||
return ret
|
||||
if 'position' not in kwargs:
|
||||
ret['result'] = True
|
||||
ret['comment'] = 'iptables rule for {0} already absent for {1} ({2})'.format(
|
||||
name,
|
||||
family,
|
||||
command.strip())
|
||||
return ret
|
||||
if __opts__['test']:
|
||||
ret['comment'] = 'iptables rule for {0} needs to be deleted for {1} ({2})'.format(
|
||||
name,
|
||||
|
|
Loading…
Add table
Reference in a new issue