mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
update to use isdigit and updated tests
This commit is contained in:
@@ -103,11 +103,11 @@ def main():
|
|||||||
timeout = module.params.get('timeout')
|
timeout = module.params.get('timeout')
|
||||||
|
|
||||||
# Attempt to look up project based on the provided name or id
|
# Attempt to look up project based on the provided name or id
|
||||||
if name.isnumeric():
|
if name.isdigit():
|
||||||
results = module.get_endpoint('projects', **{'data': {'id': name}})
|
results = module.get_endpoint('projects', **{'data': {'id': name}})
|
||||||
|
if results['json']['count'] == 0:
|
||||||
|
module.fail_json(msg='Could not find Project with ID: {0}'.format(name))
|
||||||
project = results['json']['results'][0]
|
project = results['json']['results'][0]
|
||||||
if project is None:
|
|
||||||
module.fail_json(msg="Unable to find project")
|
|
||||||
else:
|
else:
|
||||||
lookup_data = {'name': name}
|
lookup_data = {'name': name}
|
||||||
if organization:
|
if organization:
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
scm_type: git
|
scm_type: git
|
||||||
scm_url: https://github.com/ansible/test-playbooks
|
scm_url: https://github.com/ansible/test-playbooks
|
||||||
wait: false
|
wait: false
|
||||||
register: result
|
register: project_create_result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- result is changed
|
- project_create_result is changed
|
||||||
|
|
||||||
- name: Update a project without waiting
|
- name: Update a project without waiting
|
||||||
tower_project_update:
|
tower_project_update:
|
||||||
@@ -43,6 +43,17 @@
|
|||||||
that:
|
that:
|
||||||
- result is successful
|
- result is successful
|
||||||
|
|
||||||
|
- name: Update a project by ID
|
||||||
|
tower_project_update:
|
||||||
|
name: "{{ project_create_result.id }}"
|
||||||
|
organization: Default
|
||||||
|
wait: true
|
||||||
|
register: result
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- result is successful
|
||||||
|
|
||||||
- name: Delete the test project 1
|
- name: Delete the test project 1
|
||||||
tower_project:
|
tower_project:
|
||||||
name: "{{ project_name1 }}"
|
name: "{{ project_name1 }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user