mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 16:47:45 -02:30
update delete
This commit is contained in:
@@ -236,9 +236,15 @@ def main():
|
||||
existing_item = module.get_one('workflow_job_template_nodes', **{'data': search_fields})
|
||||
|
||||
if state == 'absent':
|
||||
# Look up existing approval node for deletion
|
||||
if existing_item['related'].get('unified_job_template') is not None:
|
||||
existing_approval_node = module.get_endpoint(existing_item['related']['unified_job_template'])['json']
|
||||
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
||||
module.delete_if_needed(existing_item, on_continue=True,)
|
||||
else:
|
||||
# Delete the Approval Node
|
||||
module.delete_if_needed(existing_approval_node, on_continue=True,)
|
||||
# Delete Workflow Node
|
||||
module.delete_if_needed(existing_item)
|
||||
|
||||
unified_job_template = module.params.get('unified_job_template')
|
||||
if unified_job_template:
|
||||
new_fields['unified_job_template'] = module.resolve_name_to_id('unified_job_templates', unified_job_template)
|
||||
@@ -311,9 +317,6 @@ def main():
|
||||
# Due to not able to lookup workflow_approval_templates, find the existing item in another place
|
||||
if workflow_job_template_node['related'].get('unified_job_template') is not None:
|
||||
existing_item = module.get_endpoint(workflow_job_template_node['related']['unified_job_template'])['json']
|
||||
if state == 'absent':
|
||||
# If the state was absent we can let the module delete it if needed, the module will handle exiting from this
|
||||
module.delete_if_needed(existing_item)
|
||||
module.create_or_update_if_needed(
|
||||
existing_item, new_fields,
|
||||
endpoint='workflow_job_template_nodes/' + str(workflow_job_template_node_id) + '/create_approval_template/', item_type='workflow_job_template_approval_node', on_continue=approval_node,
|
||||
|
||||
Reference in New Issue
Block a user