mirror of
https://github.com/ZwareBear/awx.git
synced 2026-03-20 07:43:35 -05:00
Merge pull request #13595 from sean-m-sullivan/devel
fix inventory prompt on launch for workflow nodes
This commit is contained in:
@@ -183,7 +183,21 @@ options:
|
|||||||
inventory:
|
inventory:
|
||||||
description:
|
description:
|
||||||
- Inventory applied as a prompt, if job template prompts for inventory
|
- Inventory applied as a prompt, if job template prompts for inventory
|
||||||
type: str
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- Name Inventory to be applied to job as launch-time prompts.
|
||||||
|
type: str
|
||||||
|
organization:
|
||||||
|
description:
|
||||||
|
- Name of key for use in model for organizational reference
|
||||||
|
type: dict
|
||||||
|
suboptions:
|
||||||
|
name:
|
||||||
|
description:
|
||||||
|
- The organization of the credentials exists in.
|
||||||
|
type: str
|
||||||
scm_branch:
|
scm_branch:
|
||||||
description:
|
description:
|
||||||
- SCM branch applied as a prompt, if job template prompts for SCM branch
|
- SCM branch applied as a prompt, if job template prompts for SCM branch
|
||||||
@@ -544,6 +558,10 @@ EXAMPLES = '''
|
|||||||
type: job_template
|
type: job_template
|
||||||
execution_environment:
|
execution_environment:
|
||||||
name: My EE
|
name: My EE
|
||||||
|
inventory:
|
||||||
|
name: Test inventory
|
||||||
|
organization:
|
||||||
|
name: Default
|
||||||
related:
|
related:
|
||||||
credentials:
|
credentials:
|
||||||
- name: cyberark
|
- name: cyberark
|
||||||
@@ -613,10 +631,6 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
|
|||||||
if workflow_node['unified_job_template']['type'] != 'workflow_approval':
|
if workflow_node['unified_job_template']['type'] != 'workflow_approval':
|
||||||
module.fail_json(msg="Unable to Find unified_job_template: {0}".format(search_fields))
|
module.fail_json(msg="Unable to Find unified_job_template: {0}".format(search_fields))
|
||||||
|
|
||||||
inventory = workflow_node.get('inventory')
|
|
||||||
if inventory:
|
|
||||||
workflow_node_fields['inventory'] = module.resolve_name_to_id('inventories', inventory)
|
|
||||||
|
|
||||||
# Lookup Values for other fields
|
# Lookup Values for other fields
|
||||||
|
|
||||||
for field_name in (
|
for field_name in (
|
||||||
@@ -645,6 +659,17 @@ def create_workflow_nodes(module, response, workflow_nodes, workflow_id):
|
|||||||
'execution_environments', name_or_id=workflow_node['execution_environment']['name']
|
'execution_environments', name_or_id=workflow_node['execution_environment']['name']
|
||||||
)['id']
|
)['id']
|
||||||
|
|
||||||
|
# Two lookup methods are used based on a fix added in 21.11.0, and the awx export model
|
||||||
|
if 'inventory' in workflow_node:
|
||||||
|
if 'name' in workflow_node['inventory']:
|
||||||
|
inv_lookup_data = {}
|
||||||
|
if 'organization' in workflow_node['inventory']:
|
||||||
|
inv_lookup_data['organization'] = module.resolve_name_to_id('organizations', workflow_node['inventory']['organization']['name'])
|
||||||
|
workflow_node_fields['inventory'] = module.get_one(
|
||||||
|
'inventories', name_or_id=workflow_node['inventory']['name'], data=inv_lookup_data)['id']
|
||||||
|
else:
|
||||||
|
workflow_node_fields['inventory'] = module.get_one('inventories', name_or_id=workflow_node['inventory'])['id']
|
||||||
|
|
||||||
# Set Search fields
|
# Set Search fields
|
||||||
search_fields['workflow_job_template'] = workflow_node_fields['workflow_job_template'] = workflow_id
|
search_fields['workflow_job_template'] = workflow_node_fields['workflow_job_template'] = workflow_id
|
||||||
|
|
||||||
|
|||||||
@@ -493,6 +493,7 @@
|
|||||||
workflow_job_template:
|
workflow_job_template:
|
||||||
name: "copy_{{ wfjt_name }}"
|
name: "copy_{{ wfjt_name }}"
|
||||||
organization: Default
|
organization: Default
|
||||||
|
ask_inventory_on_launch: true
|
||||||
survey_spec:
|
survey_spec:
|
||||||
name: Basic Survey
|
name: Basic Survey
|
||||||
description: Basic Survey
|
description: Basic Survey
|
||||||
@@ -737,6 +738,10 @@
|
|||||||
timeout: 23
|
timeout: 23
|
||||||
execution_environment:
|
execution_environment:
|
||||||
name: "{{ ee1 }}"
|
name: "{{ ee1 }}"
|
||||||
|
inventory:
|
||||||
|
name: Test inventory
|
||||||
|
organization:
|
||||||
|
name: Default
|
||||||
related:
|
related:
|
||||||
credentials:
|
credentials:
|
||||||
- name: "{{ scm_cred_name }}"
|
- name: "{{ scm_cred_name }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user