1
0
Fork 0
mirror of https://github.com/ansible-collections/ansible.posix.git synced 2026-02-04 08:01:49 +00:00

Update firewalld module to consider the value of the masquerade parameter when determining if masquerade should be enabled/disabled.

This commit is contained in:
Gregory Furlong 2022-12-14 10:50:15 -05:00
parent 090706b581
commit e647e147a1
3 changed files with 185 additions and 9 deletions

View file

@ -973,12 +973,21 @@ def main():
msgs = msgs + transaction_msgs
if masquerade is not None:
# Type of masquerade will be changed to boolean in a future release.
masquerade_status = True
try:
masquerade_status = boolean(masquerade, True)
except TypeError:
module.warn('The value of the masquerade option is "%s". '
'The type of the option will be changed from string to boolean in a future release. '
'To avoid unexpected behavior, please change the value to boolean.' % masquerade)
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade_status else 'disabled'
transaction = MasqueradeTransaction(
module,
action_args=(),
zone=zone,
desired_state=desired_state,
desired_state=expected_state,
permanent=permanent,
immediate=immediate,
)
@ -986,14 +995,6 @@ def main():
changed, transaction_msgs = transaction.run()
msgs = msgs + transaction_msgs
# Type of masquerade will be changed to boolean in a future release.
try:
boolean(masquerade, True)
except TypeError:
module.warn('The value of the masquerade option is "%s". '
'The type of the option will be changed from string to boolean in a future release. '
'To avoid unexpected behavior, please change the value to boolean.' % masquerade)
if target is not None:
transaction = ZoneTargetTransaction(