rename variable 'pkg' in yum module such that the auto-handled error messages use the same key.

This commit is contained in:
Michael DeHaan 2012-08-11 18:16:10 -04:00
parent 3b81df1e67
commit 331ee3a0a4

14
yum
View file

@ -403,9 +403,9 @@ def ensure(module, state, pkgspec, conf_file):
return dict(changed=False, failed=True, results='', errors='unexpected state') return dict(changed=False, failed=True, results='', errors='unexpected state')
def main(): def main():
# state=installed pkg=pkgspec # state=installed name=pkgspec
# state=removed pkg=pkgspec # state=removed name=pkgspec
# state=latest pkg=pkgspec # state=latest name=pkgspec
# #
# informational commands: # informational commands:
# list=installed # list=installed
@ -416,14 +416,14 @@ def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict( argument_spec = dict(
pkg=dict(aliases=['name']), name=dict(aliases=['name']),
# removed==absent, installed==present, these are accepted as aliases # removed==absent, installed==present, these are accepted as aliases
state=dict(default='installed', choices=['absent','present','installed','removed','latest']), state=dict(default='installed', choices=['absent','present','installed','removed','latest']),
list=dict(), list=dict(),
conf_file=dict(default=None), conf_file=dict(default=None),
), ),
required_one_of = [['pkg','list']], required_one_of = [['name','list']],
mutually_exclusive = [['pkg','list']] mutually_exclusive = [['name','list']]
) )
params = module.params params = module.params
@ -435,7 +435,7 @@ def main():
module.exit_json(**results) module.exit_json(**results)
else: else:
pkg = params['pkg'] pkg = params['name']
state = params['state'] state = params['state']
res = ensure(module, state, pkg, params['conf_file']) res = ensure(module, state, pkg, params['conf_file'])
module.fail_json(msg="we should never get here unless this all failed", **res) module.fail_json(msg="we should never get here unless this all failed", **res)