From 130f6300c5b4cb44029fe40788b1ce3d36ec6f01 Mon Sep 17 00:00:00 2001 From: Anton Nesterov Date: Tue, 20 Oct 2020 21:15:28 +0200 Subject: [PATCH] Fix missing alias in argument_spec and add tests for it --- .../modules/tower_inventory_source_update.py | 2 +- .../tower_inventory_source_update/tasks/main.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/awx_collection/plugins/modules/tower_inventory_source_update.py b/awx_collection/plugins/modules/tower_inventory_source_update.py index 2b401cad57..332dbc60ef 100644 --- a/awx_collection/plugins/modules/tower_inventory_source_update.py +++ b/awx_collection/plugins/modules/tower_inventory_source_update.py @@ -90,7 +90,7 @@ from ..module_utils.tower_api import TowerAPIModule def main(): # Any additional arguments that are not fields of the item can be added here argument_spec = dict( - name=dict(required=True), + name=dict(required=True, aliases=['inventory_source']), inventory=dict(required=True), organization=dict(), wait=dict(default=False, type='bool'), diff --git a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml b/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml index afb1bd962f..414e052fe6 100644 --- a/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml +++ b/awx_collection/tests/integration/targets/tower_inventory_source_update/tasks/main.yml @@ -97,6 +97,21 @@ that: - "result is changed" + - name: Test Inventory Source Update for All Sources (using inventory_source as alias for name) + tower_inventory_source_update: + inventory_source: "{{ item.name }}" + inventory: "{{ inv_name }}" + organization: Default + wait: true + loop: "{{ query('awx.awx.tower_api', 'inventory_sources', query_params={ 'inventory': created_inventory.id }, expect_objects=True, return_objects=True) }}" + loop_control: + label: "{{ item.name }}" + register: result + + - assert: + that: + - "result is changed" + always: - name: Delete Inventory tower_inventory: