Repository: ansible/ansible

Issue:
firewalld - set masquerade
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
firewalld module

##### ANSIBLE VERSION
```
ansible 2.3.0 (devel 76c9ad9dfc) last updated 2017/02/19 14:00:22 (GMT +200)
  config file = /home/tomas/ansible/net/ansible.cfg
  configured module search path = Default w/o overrides
```
##### FIREWALLD VERSION
```
firewalld.noarch          0.4.4.2-2.fc24
python-firewall.noarch    0.4.4.2-2.fc24
```

##### CONFIGURATION
Default

##### OS / ENVIRONMENT
Fedora 24

##### SUMMARY
Setting masquerade option for zone with firewalld module failed with error:
`ERROR: Exception caught: get_masquerade_enabled_permanent() takes exactly 1 argument (6 given)`

##### STEPS TO REPRODUCE
Run `ansible-playbook firewall.yml`

firewall.yml is here:
```yaml
- hosts: all
  become: yes
  tasks:
  - name: Set masquarade for zones
    tags:
      - firewalld
    firewalld:
      zone: SmazMe
      masquerade: yes
      permanent: true
      state: enabled
```

##### EXPECTED RESULTS
Set firewalld masquerade option for zone SmazMe

##### ACTUAL RESULTS
Action failed with error.

```
fatal: [localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "immediate": false, 
            "interface": null, 
            "masquerade": "True", 
            "offline": null, 
            "permanent": true, 
            "port": null, 
            "rich_rule": null, 
            "service": null, 
            "source": null, 
            "state": "enabled", 
            "timeout": 0, 
            "zone": "SmazMe"
        }
    }, 
    "msg": "ERROR: Exception caught: get_masquerade_enabled_permanent() takes exactly 1 argument (6 given)"
}
```



Discussion:
cc @maxamillion
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/system/firewalld.py b/lib/ansible/modules/system/firewalld.py
--- a/lib/ansible/modules/system/firewalld.py
+++ b/lib/ansible/modules/system/firewalld.py
@@ -991,9 +991,9 @@ def main():
         if immediate and permanent:
             is_enabled_permanent = action_handler(
                 get_masquerade_enabled_permanent,
-                (zone)
+                (zone,)
             )
-            is_enabled_immediate = action_handler(get_masquerade_enabled, (zone))
+            is_enabled_immediate = action_handler(get_masquerade_enabled, (zone,))
             msgs.append('Permanent and Non-Permanent(immediate) operation')
 
             if desired_state == "enabled":
@@ -1023,7 +1023,7 @@ def main():
                     msgs.append("Removed masquerade from zone %s" % (zone))
 
         elif permanent and not immediate:
-            is_enabled = action_handler(get_masquerade_enabled_permanent, (zone))
+            is_enabled = action_handler(get_masquerade_enabled_permanent, (zone,))
             msgs.append('Permanent operation')
 
             if desired_state == "enabled":
@@ -1043,7 +1043,7 @@ def main():
                     changed=True
                     msgs.append("Removed masquerade from zone %s" % (zone))
         elif immediate and not permanent:
-            is_enabled = action_handler(get_masquerade_enabled, (zone))
+            is_enabled = action_handler(get_masquerade_enabled, (zone,))
             msgs.append('Non-permanent operation')
 
             if desired_state == "enabled":


Test patch: