mirror of
https://github.com/ansible/awx.git
synced 2026-03-09 05:29:26 -02:30
update logic for node creation
This commit is contained in:
@@ -205,13 +205,17 @@ def main():
|
|||||||
state=dict(choices=['present', 'absent'], default='present'),
|
state=dict(choices=['present', 'absent'], default='present'),
|
||||||
)
|
)
|
||||||
mutually_exclusive = [("unified_job_template", "approval_node")]
|
mutually_exclusive = [("unified_job_template", "approval_node")]
|
||||||
required_one_of = [["unified_job_template", "approval_node", "success_nodes", "always_nodes", "failure_nodes"]]
|
required_if=[
|
||||||
|
['state', 'absent', ['identifier']],
|
||||||
|
['state', 'present', ['identifier']],
|
||||||
|
['state', 'present', ['unified_job_template', 'approval_node', 'success_nodes', 'always_nodes', 'failure_nodes'], 'true'],
|
||||||
|
]
|
||||||
|
|
||||||
# Create a module for ourselves
|
# Create a module for ourselves
|
||||||
module = TowerAPIModule(
|
module = TowerAPIModule(
|
||||||
argument_spec=argument_spec,
|
argument_spec=argument_spec,
|
||||||
mutually_exclusive=mutually_exclusive,
|
mutually_exclusive=mutually_exclusive,
|
||||||
required_one_of=required_one_of,
|
required_if=required_if,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Extract our parameters
|
# Extract our parameters
|
||||||
|
|||||||
@@ -159,6 +159,30 @@
|
|||||||
that:
|
that:
|
||||||
- "no_name_results.msg == 'Approval node name is required to create approval node.'"
|
- "no_name_results.msg == 'Approval node name is required to create approval node.'"
|
||||||
|
|
||||||
|
- name: Fail if absent and no identifier set
|
||||||
|
tower_workflow_job_template_node:
|
||||||
|
approval_node:
|
||||||
|
description: "{{ approval_node_name }}"
|
||||||
|
workflow: "{{ wfjt_name }}"
|
||||||
|
state: absent
|
||||||
|
register: no_identifier_results
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "no_identifier_results.msg == 'missing required arguments: identifier'"
|
||||||
|
|
||||||
|
- name: Fail if present and no unified job template set
|
||||||
|
tower_workflow_job_template_node:
|
||||||
|
identifier: approval_test
|
||||||
|
workflow: "{{ wfjt_name }}"
|
||||||
|
register: no_unified_results
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- "no_unified_results.msg == 'state is present but any of the following are missing: unified_job_template, approval_node, success_nodes, always_nodes, failure_nodes'"
|
||||||
|
|
||||||
- name: Create approval node
|
- name: Create approval node
|
||||||
tower_workflow_job_template_node:
|
tower_workflow_job_template_node:
|
||||||
identifier: approval_test
|
identifier: approval_test
|
||||||
|
|||||||
Reference in New Issue
Block a user