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
reviewable/pr18780/r1
Indrajit Raychaudhuri 9 years ago
parent e8d6c04502
commit 791967485b

@ -3,6 +3,7 @@
# (c) 2013, Andrew Dunham <andrew@du.nham.ca> # (c) 2013, Andrew Dunham <andrew@du.nham.ca>
# (c) 2013, Daniel Jaouen <dcj24@cornell.edu> # (c) 2013, Daniel Jaouen <dcj24@cornell.edu>
# (c) 2015, Indrajit Raychaudhuri <irc+code@indrajit.com>
# #
# Based on macports (Jimmy Tang <jcftang@gmail.com>) # Based on macports (Jimmy Tang <jcftang@gmail.com>)
# #
@ -23,6 +24,7 @@ DOCUMENTATION = '''
--- ---
module: homebrew module: homebrew
author: author:
- "Indrajit Raychaudhuri (@indrajitr)"
- "Daniel Jaouen (@danieljaouen)" - "Daniel Jaouen (@danieljaouen)"
- "Andrew Dunham (@andrew-d)" - "Andrew Dunham (@andrew-d)"
short_description: Package manager for Homebrew short_description: Package manager for Homebrew
@ -45,13 +47,13 @@ options:
description: description:
- update homebrew itself first - update homebrew itself first
required: false required: false
default: "no" default: no
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
upgrade_all: upgrade_all:
description: description:
- upgrade all homebrew packages - upgrade all homebrew packages
required: false required: false
default: "no" default: no
choices: [ "yes", "no" ] choices: [ "yes", "no" ]
install_options: install_options:
description: description:
@ -763,7 +765,7 @@ class Homebrew(object):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
name=dict(aliases=["pkg"], required=False), name=dict(aliases=["pkg", "package"], required=False, type='list'),
path=dict(required=False), path=dict(required=False),
state=dict( state=dict(
default="present", default="present",
@ -775,12 +777,12 @@ def main():
], ],
), ),
update_homebrew=dict( update_homebrew=dict(
default="no", default=False,
aliases=["update-brew"], aliases=["update-brew"],
type='bool', type='bool',
), ),
upgrade_all=dict( upgrade_all=dict(
default="no", default=False,
aliases=["upgrade"], aliases=["upgrade"],
type='bool', type='bool',
), ),
@ -795,7 +797,7 @@ def main():
p = module.params p = module.params
if p['name']: if p['name']:
packages = p['name'].split(',') packages = p['name']
else: else:
packages = None packages = None
@ -839,4 +841,3 @@ from ansible.module_utils.basic import *
if __name__ == '__main__': if __name__ == '__main__':
main() main()

Loading…
Cancel
Save