fix WorkflowJobTemplate export where WorkflowApprovalTemplate is not properly exported

fixes https://github.com/ansible/awx/issues/7946
- added WorkflowApprovalTemplate page type to allow URL registration
- added resources regex that’s associated resource URL with WorkflowApprovalTemplate
- registered the new resource regex with WorkflowApprovalTemplate page type
- modified `DEPENDENT_EXPORT` handling (insisted by @jbradberry)
- added special case handling for WorkflowApprovalTemplate due to its unique nature

unique nature of WorkflowApprovalTemplate
- when exporting WorkflowJobTemplate with approval node the WorkflowJobTemplateNode need to contain a related "create_approval_template" the POST data for "create_approval_template" need to come from the "workflow_approval_template"
- during the export of a WorkflowJobTemplateNode that is an approval node we need to get the data from "workflow_approval_template" and use that to populate the "create_approval_template"

Co-Authored-By: Jeff Bradberry <685957+jbradberry@users.noreply.github.com>
Signed-off-by: Hao Liu <haoli@redhat.com>
This commit is contained in:
Hao Liu
2022-07-12 19:02:23 -04:00
parent 8031b3d402
commit 769c253ac2
4 changed files with 80 additions and 19 deletions

View File

@@ -82,6 +82,9 @@ class Resources(object):
_inventory_variable_data = r'inventories/\d+/variable_data/'
_workflow_approval = r'workflow_approvals/\d+/'
_workflow_approvals = 'workflow_approvals/'
_workflow_approval_template = r'workflow_approval_templates/\d+/'
_workflow_approval_templates = 'workflow_approval_templates/'
_workflow_job_template_node_create_approval_template = r'workflow_job_template_nodes/\d+/create_approval_template/'
_job = r'jobs/\d+/'
_job_cancel = r'jobs/\d+/cancel/'
_job_create_schedule = r'jobs/\d+/create_schedule/'