Follow same pattern as project update module, add task to integration test

This commit is contained in:
beeankha 2020-09-04 10:39:25 -04:00
parent 7764f1c1a5
commit 4133ec974b
2 changed files with 26 additions and 12 deletions

View File

@ -135,19 +135,22 @@ def main():
if inventory_source_update_results['status_code'] != 202:
module.fail_json(msg="Failed to update inventory source, see response for details", **{'response': inventory_source_update_results})
if wait:
inventory_source_update_results = module.wait_on_url(
url=inventory_source_update_results['json']['url'],
object_name=inventory_object,
object_type='inventory_update',
timeout=timeout, interval=interval
)
module.json_output['changed'] = True
module.json_output['id'] = inventory_source_update_results['json']['id']
module.json_output['status'] = inventory_source_update_results['json']['status']
module.exit_json(**{
'changed': True,
'id': inventory_source_update_results['json']['id'],
'status': inventory_source_update_results['json']['status'],
})
if not wait:
module.exit_json(**module.json_output)
# Invoke wait function
module.wait_on_url(
url=inventory_source_update_results['json']['url'],
object_name=inventory_object,
object_type='inventory_update',
timeout=timeout, interval=interval
)
module.exit_json(**module.json_output)
if __name__ == '__main__':

View File

@ -9,6 +9,7 @@
inv_name: "AWX-Collection-tests-tower_inventory_source_update-inv-{{ test_id }}"
inv_source1: "AWX-Collection-tests-tower_inventory_source_update-source1-{{ test_id }}"
inv_source2: "AWX-Collection-tests-tower_inventory_source_update-source2-{{ test_id }}"
inv_source3: "AWX-Collection-tests-tower_inventory_source_update-source3-{{ test_id }}"
org_name: "AWX-Collection-tests-tower_inventory_source_update-org-{{ test_id }}"
@ -60,6 +61,16 @@
organization: Default
inventory: "{{ inv_name }}"
- name: Create Yet Another Inventory Source (one more to make lookup plugin find multiple inventory sources)
tower_inventory_source:
name: "{{ inv_source3 }}"
source: scm
source_project: "{{ project_name }}"
source_path: inventories/create_100_hosts.ini
description: Source for Test inventory
organization: Default
inventory: "{{ inv_name }}"
- name: Test Inventory Source Update
tower_inventory_source_update:
inventory: "{{ inv_name }}"