From 4d50f557bd00c4de067785ad486d765ba85818c7 Mon Sep 17 00:00:00 2001 From: Kevin Brebanov Date: Wed, 29 Jul 2015 16:22:32 -0400 Subject: [PATCH] Modify 'name' argument to be of type 'list' in order to support 'with_items' looping --- lib/ansible/modules/extras/packaging/os/apk.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/extras/packaging/os/apk.py b/lib/ansible/modules/extras/packaging/os/apk.py index 4b78a898901..f8ddbc2aa04 100644 --- a/lib/ansible/modules/extras/packaging/os/apk.py +++ b/lib/ansible/modules/extras/packaging/os/apk.py @@ -177,7 +177,7 @@ def main(): module = AnsibleModule( argument_spec = dict( state = dict(default='present', choices=['present', 'installed', 'absent', 'removed', 'latest']), - name = dict(type='str'), + name = dict(type='list'), update_cache = dict(default='no', choices=BOOLEANS, type='bool'), upgrade = dict(default='no', choices=BOOLEANS, type='bool'), ), @@ -204,14 +204,10 @@ def main(): if p['upgrade']: upgrade_packages(module) - # Create a list of package names - # Removing empty strings that may have been created by a trailing ',' - names = filter((lambda x: x != ''), p['name'].split(',')) - if p['state'] in ['present', 'latest']: - install_packages(module, names, p['state']) + install_packages(module, p['name'], p['state']) elif p['state'] == 'absent': - remove_packages(module, names) + remove_packages(module, p['name']) # Import module snippets. from ansible.module_utils.basic import *