From 791967485bf9414b3d10d1341285a76854dfe094 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Tue, 29 Sep 2015 02:40:55 -0500 Subject: [PATCH 1/2] homebrew: Improve 'argument_spec' handling - Remove choice list for boolean values in argument_spec and make it more consistent with core modules - Add 'package' alias and support for list type for 'name' parameter - Added self as maintainer --- packaging/os/homebrew.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packaging/os/homebrew.py b/packaging/os/homebrew.py index 91888ba6bca..6b3aea550a8 100644 --- a/packaging/os/homebrew.py +++ b/packaging/os/homebrew.py @@ -3,6 +3,7 @@ # (c) 2013, Andrew Dunham # (c) 2013, Daniel Jaouen +# (c) 2015, Indrajit Raychaudhuri # # Based on macports (Jimmy Tang ) # @@ -23,6 +24,7 @@ DOCUMENTATION = ''' --- module: homebrew author: + - "Indrajit Raychaudhuri (@indrajitr)" - "Daniel Jaouen (@danieljaouen)" - "Andrew Dunham (@andrew-d)" short_description: Package manager for Homebrew @@ -45,13 +47,13 @@ options: description: - update homebrew itself first required: false - default: "no" + default: no choices: [ "yes", "no" ] upgrade_all: description: - upgrade all homebrew packages required: false - default: "no" + default: no choices: [ "yes", "no" ] install_options: description: @@ -763,7 +765,7 @@ class Homebrew(object): def main(): module = AnsibleModule( argument_spec=dict( - name=dict(aliases=["pkg"], required=False), + name=dict(aliases=["pkg", "package"], required=False, type='list'), path=dict(required=False), state=dict( default="present", @@ -775,12 +777,12 @@ def main(): ], ), update_homebrew=dict( - default="no", + default=False, aliases=["update-brew"], type='bool', ), upgrade_all=dict( - default="no", + default=False, aliases=["upgrade"], type='bool', ), @@ -795,7 +797,7 @@ def main(): p = module.params if p['name']: - packages = p['name'].split(',') + packages = p['name'] else: packages = None @@ -839,4 +841,3 @@ from ansible.module_utils.basic import * if __name__ == '__main__': main() - From 02c17c023a2c98333fb997429f2fbf6c308e5695 Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Sun, 4 Oct 2015 22:13:35 -0500 Subject: [PATCH 2/2] homebrew: Also add 'formula' as alias for 'name' and reformat --- packaging/os/homebrew.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/os/homebrew.py b/packaging/os/homebrew.py index 6b3aea550a8..9d41dcd69a2 100644 --- a/packaging/os/homebrew.py +++ b/packaging/os/homebrew.py @@ -765,7 +765,11 @@ class Homebrew(object): def main(): module = AnsibleModule( argument_spec=dict( - name=dict(aliases=["pkg", "package"], required=False, type='list'), + name=dict( + aliases=["pkg", "package", "formula"], + required=False, + type='list', + ), path=dict(required=False), state=dict( default="present",