Merge pull request #1 from mscherer/devel

Add a new option immediate= to immediately apply a permanent change
reviewable/pr18780/r1
Brian Coca 10 years ago
commit fdd41fb95c

@ -52,6 +52,12 @@ options:
- "Should this configuration be in the running firewalld configuration or persist across reboots" - "Should this configuration be in the running firewalld configuration or persist across reboots"
required: true required: true
default: true default: true
immediate:
description:
- "Should this configuration be applied immediately, if set as permanent"
required: false
default: false
version_added: "1.9"
state: state:
description: description:
- "Should this port accept(enabled) or reject(disabled) connections" - "Should this port accept(enabled) or reject(disabled) connections"
@ -211,6 +217,7 @@ def main():
rich_rule=dict(required=False,default=None), rich_rule=dict(required=False,default=None),
zone=dict(required=False,default=None), zone=dict(required=False,default=None),
permanent=dict(type='bool',required=True), permanent=dict(type='bool',required=True),
immediate=dict(type='bool',default=False),
state=dict(choices=['enabled', 'disabled'], required=True), state=dict(choices=['enabled', 'disabled'], required=True),
timeout=dict(type='int',required=False,default=0), timeout=dict(type='int',required=False,default=0),
), ),
@ -241,6 +248,7 @@ def main():
permanent = module.params['permanent'] permanent = module.params['permanent']
desired_state = module.params['state'] desired_state = module.params['state']
immediate = module.params['immediate']
timeout = module.params['timeout'] timeout = module.params['timeout']
## Check for firewalld running ## Check for firewalld running
@ -281,7 +289,7 @@ def main():
set_service_disabled_permanent(zone, service) set_service_disabled_permanent(zone, service)
changed=True changed=True
else: if immediate or not permanent:
is_enabled = get_service_enabled(zone, service) is_enabled = get_service_enabled(zone, service)
msgs.append('Non-permanent operation') msgs.append('Non-permanent operation')
@ -323,7 +331,7 @@ def main():
set_port_disabled_permanent(zone, port, protocol) set_port_disabled_permanent(zone, port, protocol)
changed=True changed=True
else: if immediate or not permanent:
is_enabled = get_port_enabled(zone, [port,protocol]) is_enabled = get_port_enabled(zone, [port,protocol])
msgs.append('Non-permanent operation') msgs.append('Non-permanent operation')
@ -365,7 +373,7 @@ def main():
set_rich_rule_disabled_permanent(zone, rich_rule) set_rich_rule_disabled_permanent(zone, rich_rule)
changed=True changed=True
else: if immediate or not permanent:
is_enabled = get_rich_rule_enabled(zone, rich_rule) is_enabled = get_rich_rule_enabled(zone, rich_rule)
msgs.append('Non-permanent operation') msgs.append('Non-permanent operation')

Loading…
Cancel
Save