From 2e211078ce288bb5d71aae7d013147f4f378e6d5 Mon Sep 17 00:00:00 2001 From: Trishna Guha Date: Thu, 17 Aug 2017 12:44:55 +0530 Subject: [PATCH] fix vyos_user aggregate (#28317) Signed-off-by: Trishna Guha --- lib/ansible/modules/network/vyos/vyos_user.py | 12 ++++++------ .../targets/vyos_user/tests/cli/basic.yaml | 10 +++++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/network/vyos/vyos_user.py b/lib/ansible/modules/network/vyos/vyos_user.py index 79d6728ce3..83762aa602 100644 --- a/lib/ansible/modules/network/vyos/vyos_user.py +++ b/lib/ansible/modules/network/vyos/vyos_user.py @@ -27,7 +27,7 @@ DOCUMENTATION = """ --- module: vyos_user version_added: "2.4" -author: "Trishna Guha (@trishnag)" +author: "Trishna Guha (@trishnaguha)" short_description: Manage the collection of local users on VyOS device description: - This module provides declarative management of the local usernames @@ -231,18 +231,18 @@ def map_params_to_obj(module): if not module.params['name'] and module.params['purge']: return list() else: - aggregate = [{'name': module.params['name']}] + aggregatelist = [{'name': module.params['name']}] else: - aggregate = list() + aggregatelist = list() for item in aggregate: if not isinstance(item, dict): - aggregate.append({'name': item}) + aggregatelist.append({'name': item}) else: - aggregate.append(item) + aggregatelist.append(item) objects = list() - for item in aggregate: + for item in aggregatelist: get_value = partial(get_param_value, item=item, module=module) item['password'] = get_value('password') item['full_name'] = get_value('full_name') diff --git a/test/integration/targets/vyos_user/tests/cli/basic.yaml b/test/integration/targets/vyos_user/tests/cli/basic.yaml index 9e3df24994..178c6eca05 100644 --- a/test/integration/targets/vyos_user/tests/cli/basic.yaml +++ b/test/integration/targets/vyos_user/tests/cli/basic.yaml @@ -1,5 +1,13 @@ --- -- name: Create user (SetUp) +- name: Setup + vyos_config: + lines: + - delete system login user ansibletest1 + - delete system login user ansibletest2 + - delete system login user ansibletest3 + provider: "{{ cli }}" + +- name: Create user vyos_user: name: ansibletest1 password: test