Repository: ansible/ansible-modules-extras

Issue:
pkgutil: the values of update_catalog get always translated to true or false, but the module expects yes or no.
##### ISSUE TYPE
- Bug Report
##### COMPONENT NAME

packaging/os/pkgutil.py
##### ANSIBLE VERSION

```
ansible 2.1.0.0-RC1
ansible 2.1.0.0 (detached HEAD 5954a82dd6) last updated 2016/05/02 13:45:40 (GMT +200)
  lib/ansible/modules/core: (detached HEAD ce79e7c72d) last updated 2016/05/02 13:46:30 (GMT +200)
  lib/ansible/modules/extras: (detached HEAD 156a8cd0b3) last updated 2016/05/02 13:46:30 (GMT +200)
```
##### CONFIGURATION
##### OS / ENVIRONMENT

Running on MacOS X 10.11.4 against Solaris 10
##### SUMMARY

Argument update_catalog gets wrong values false and true instead of no and yes 
##### STEPS TO REPRODUCE

```
ansible myhost -m pkgutil -a "name=CSWgnupg state=present" -u root
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "name": "CSWgnupg", 
            "state": "present", 
            "update_catalog": false
        }, 
        "module_name": "pkgutil"
    }, 
    "msg": "value of update_catalog must be one of: yes,no, got: False"
}
```
##### EXPECTED RESULTS

CSW package gnupg should be installed.
##### ACTUAL RESULTS

The values of update_catalog get always translated to true or false, but the module expects yes or no.

```
ansible myhost -m pkgutil -a "name=CSWgnupg state=present" -u root
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "name": "CSWgnupg", 
            "state": "present", 
            "update_catalog": false
        }, 
        "module_name": "pkgutil"
    }, 
    "msg": "value of update_catalog must be one of: yes,no, got: False"
}

ansible myhost -m pkgutil -a "name=CSWgnupg state=present update_catalog=no" -u root
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "name": "CSWgnupg", 
            "state": "present", 
            "update_catalog": false
        }, 
        "module_name": "pkgutil"
    }, 
    "msg": "value of update_catalog must be one of: yes,no, got: False"
}

ansible myhost -m pkgutil -a "name=CSWgnupg state=present update_catalog=false" -u root
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "name": "CSWgnupg", 
            "state": "present", 
            "update_catalog": false
        }, 
        "module_name": "pkgutil"
    }, 
    "msg": "value of update_catalog must be one of: yes,no, got: False"
}

ansible myhost -m pkgutil -a "name=CSWgnupg state=present update_catalog=yes" -u root
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "name": "CSWgnupg", 
            "state": "present", 
            "update_catalog": true
        }, 
        "module_name": "pkgutil"
    }, 
    "msg": "value of update_catalog must be one of: yes,no, got: True"
}

ansible myhost -m pkgutil -a "name=CSWgnupg state=present update_catalog=true" -u root 
myhost | FAILED! => {
    "changed": false, 
    "failed": true, 
    "msg": "value of update_catalog must be one of: yes,no, got: True"
}
```



Discussion:
The arg spec for update_catalog doesn't seem to make any sense. type=bool kind of conflicts with 'choices=['yes','no'], so both will never be true, iiuc.


Resolving patch:
diff --git a/packaging/os/pkgutil.py b/packaging/os/pkgutil.py
--- a/packaging/os/pkgutil.py
+++ b/packaging/os/pkgutil.py
@@ -54,8 +54,7 @@
     description:
       - If you want to refresh your catalog from the mirror, set this to (C(yes)).
     required: false
-    choices: ["yes", "no"]
-    default: no
+    default: False
     version_added: "2.1"
 '''
 
@@ -130,7 +129,7 @@ def main():
             name = dict(required = True),
             state = dict(required = True, choices=['present', 'absent','latest']),
             site = dict(default = None),
-            update_catalog = dict(required = False, default = "no", type='bool', choices=["yes","no"]),
+            update_catalog = dict(required = False, default = False, type='bool'),
         ),
         supports_check_mode=True
     )


Test patch: