Update awx collection workflow nodes to look for type (#12597)

This commit is contained in:
Sean Sullivan
2022-08-11 07:08:27 -04:00
committed by GitHub
parent 85a5b58d18
commit 8cf75fce8c
2 changed files with 29 additions and 4 deletions

View File

@@ -261,7 +261,7 @@ options:
type: type:
description: description:
- Name of unified job template type to run in the workflow. - Name of unified job template type to run in the workflow.
- Can be a job_template, project, inventory_source, system_job, workflow_approval, workflow_job_template. - Can be a job_template, project, inventory_source, system_job_template, workflow_approval, workflow_job_template.
type: str type: str
timeout: timeout:
description: description:
@@ -489,6 +489,7 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
if workflow_node['unified_job_template']['name']: if workflow_node['unified_job_template']['name']:
if workflow_node['unified_job_template']['type'] is None: if workflow_node['unified_job_template']['type'] is None:
module.fail_json(msg='Could not find unified job template type in workflow_nodes {1}'.format(workflow_node)) module.fail_json(msg='Could not find unified job template type in workflow_nodes {1}'.format(workflow_node))
search_fields['type'] = workflow_node['unified_job_template']['type']
if workflow_node['unified_job_template']['type'] == 'inventory_source': if workflow_node['unified_job_template']['type'] == 'inventory_source':
if 'inventory' in workflow_node['unified_job_template']: if 'inventory' in workflow_node['unified_job_template']:
if 'organization' in workflow_node['unified_job_template']['inventory']: if 'organization' in workflow_node['unified_job_template']['inventory']:

View File

@@ -110,6 +110,20 @@
that: that:
- "result is changed" - "result is changed"
- name: Create a 3rd Demo Project in another org with inventory source name
project:
name: "{{ project_inv_source }}"
organization: "{{ org_name }}"
state: present
scm_type: git
scm_url: https://github.com/ansible/ansible-tower-samples.git
scm_credential: "{{ scm_cred_name }}"
register: result
- assert:
that:
- "result is changed"
- name: Add an inventory - name: Add an inventory
inventory: inventory:
description: Test inventory description: Test inventory
@@ -573,8 +587,8 @@
- identifier: node202 - identifier: node202
unified_job_template: unified_job_template:
organization: organization:
name: Default name: "{{ org_name }}"
name: "{{ demo_project_name }}" name: "{{ project_inv_source }}"
type: project type: project
- all_parents_must_converge: false - all_parents_must_converge: false
identifier: node301 identifier: node301
@@ -586,7 +600,7 @@
- identifier: Cleanup Job - identifier: Cleanup Job
unified_job_template: unified_job_template:
name: Cleanup Activity Stream name: Cleanup Activity Stream
type: system_job type: system_job_template
register: result register: result
- assert: - assert:
@@ -761,6 +775,16 @@
state: absent state: absent
ignore_errors: True ignore_errors: True
- name: Delete the 3rd Demo Project
project:
name: "{{ project_inv_source }}"
organization: "{{ org_name }}"
scm_type: git
scm_url: https://github.com/ansible/ansible-tower-samples.git
scm_credential: "{{ scm_cred_name }}"
state: absent
ignore_errors: True
- name: Delete the SCM Credential - name: Delete the SCM Credential
credential: credential:
name: "{{ scm_cred_name }}" name: "{{ scm_cred_name }}"