Compare commits

...

2 commits

Author SHA1 Message Date
Hideki Saito
330cec2caf
Merge 855966430a into 9171b7fcf1 2024-10-30 08:47:29 +00:00
Hideki Saito
855966430a
Changed the type of forward and masquerade options from str to bool
* Fixes #582

Signed-off-by: Hideki Saito <saito@fgrep.org>
2024-10-30 17:47:15 +09:00
2 changed files with 7 additions and 24 deletions

View file

@ -0,0 +1,3 @@
---
breaking_changes:
- firewalld - Changed the type of forward and masquerade options from str to bool (https://github.com/ansible-collections/ansible.posix/issues/582).

View file

@ -112,7 +112,7 @@ options:
description:
- The forward setting you would like to enable/disable to/from zones within firewalld.
- This option only is supported by firewalld v0.9.0 or later.
type: str
type: bool
masquerade:
description:
- The masquerade setting you would like to enable/disable to/from zones within firewalld.
@ -875,7 +875,7 @@ def main():
state=dict(type='str', required=True, choices=['absent', 'disabled', 'enabled', 'present']),
timeout=dict(type='int', default=0),
interface=dict(type='str'),
forward=dict(type='str'),
forward=dict(type='bool'),
masquerade=dict(type='str'),
offline=dict(type='bool', default=False),
target=dict(type='str', choices=['default', 'ACCEPT', 'DROP', '%%REJECT%%']),
@ -1128,17 +1128,7 @@ def main():
changed, transaction_msgs = transaction.run()
msgs = msgs + transaction_msgs
if forward is not None:
# Type of forward will be changed to boolean in a future release.
forward_status = False
try:
forward_status = boolean(forward, False)
except TypeError:
module.warn('The value of the forward 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.' % forward)
expected_state = 'enabled' if (desired_state == 'enabled') == forward_status else 'disabled'
expected_state = 'enabled' if (desired_state == 'enabled') == forward else 'disabled'
transaction = ForwardTransaction(
module,
action_args=(),
@ -1151,17 +1141,7 @@ def main():
changed, transaction_msgs = transaction.run()
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'
expected_state = 'enabled' if (desired_state == 'enabled') == masquerade else 'disabled'
transaction = MasqueradeTransaction(
module,
action_args=(),