mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 11:11:07 -03:30
Merge pull request #8058 from sean-m-sullivan/workflow_label
Workflow label Reviewed-by: Alan Rominger <arominge@redhat.com> https://github.com/AlanCoding
This commit is contained in:
@@ -480,6 +480,12 @@ def main():
|
|||||||
association_fields['labels'] = []
|
association_fields['labels'] = []
|
||||||
for item in labels:
|
for item in labels:
|
||||||
association_fields['labels'].append(module.resolve_name_to_id('labels', item))
|
association_fields['labels'].append(module.resolve_name_to_id('labels', item))
|
||||||
|
# Code to use once Issue #7567 is resolved
|
||||||
|
# search_fields = {'name': item}
|
||||||
|
# if organization:
|
||||||
|
# search_fields['organization'] = organization_id
|
||||||
|
# label_id = module.get_one('labels', **{'data': search_fields})
|
||||||
|
# association_fields['labels'].append(label_id)
|
||||||
|
|
||||||
notifications_start = module.params.get('notification_templates_started')
|
notifications_start = module.params.get('notification_templates_started')
|
||||||
if notifications_start is not None:
|
if notifications_start is not None:
|
||||||
|
|||||||
@@ -98,6 +98,11 @@ options:
|
|||||||
description:
|
description:
|
||||||
- The definition of the survey associated to the workflow.
|
- The definition of the survey associated to the workflow.
|
||||||
type: dict
|
type: dict
|
||||||
|
labels:
|
||||||
|
description:
|
||||||
|
- The labels applied to this job template
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
state:
|
state:
|
||||||
description:
|
description:
|
||||||
- Desired state of the resource.
|
- Desired state of the resource.
|
||||||
@@ -168,6 +173,7 @@ def main():
|
|||||||
ask_limit_on_launch=dict(type='bool'),
|
ask_limit_on_launch=dict(type='bool'),
|
||||||
webhook_service=dict(choices=['github', 'gitlab']),
|
webhook_service=dict(choices=['github', 'gitlab']),
|
||||||
webhook_credential=dict(),
|
webhook_credential=dict(),
|
||||||
|
labels=dict(type="list", elements='str'),
|
||||||
notification_templates_started=dict(type="list", elements='str'),
|
notification_templates_started=dict(type="list", elements='str'),
|
||||||
notification_templates_success=dict(type="list", elements='str'),
|
notification_templates_success=dict(type="list", elements='str'),
|
||||||
notification_templates_error=dict(type="list", elements='str'),
|
notification_templates_error=dict(type="list", elements='str'),
|
||||||
@@ -247,6 +253,18 @@ def main():
|
|||||||
for item in notifications_approval:
|
for item in notifications_approval:
|
||||||
association_fields['notification_templates_approvals'].append(module.resolve_name_to_id('notification_templates', item))
|
association_fields['notification_templates_approvals'].append(module.resolve_name_to_id('notification_templates', item))
|
||||||
|
|
||||||
|
labels = module.params.get('labels')
|
||||||
|
if labels is not None:
|
||||||
|
association_fields['labels'] = []
|
||||||
|
for item in labels:
|
||||||
|
association_fields['labels'].append(module.resolve_name_to_id('labels', item))
|
||||||
|
# Code to use once Issue #7567 is resolved
|
||||||
|
# search_fields = {'name': item}
|
||||||
|
# if organization:
|
||||||
|
# search_fields['organization'] = organization_id
|
||||||
|
# label_id = module.get_one('labels', **{'data': search_fields})
|
||||||
|
# association_fields['labels'].append(label_id)
|
||||||
|
|
||||||
on_change = None
|
on_change = None
|
||||||
new_spec = module.params.get('survey')
|
new_spec = module.params.get('survey')
|
||||||
if new_spec:
|
if new_spec:
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
demo_project_name: "AWX-Collection-tests-tower_workflow_job_template-proj-{{ test_id }}"
|
demo_project_name: "AWX-Collection-tests-tower_workflow_job_template-proj-{{ test_id }}"
|
||||||
jt1_name: "AWX-Collection-tests-tower_workflow_job_template-jt1-{{ test_id }}"
|
jt1_name: "AWX-Collection-tests-tower_workflow_job_template-jt1-{{ test_id }}"
|
||||||
jt2_name: "AWX-Collection-tests-tower_workflow_job_template-jt2-{{ test_id }}"
|
jt2_name: "AWX-Collection-tests-tower_workflow_job_template-jt2-{{ test_id }}"
|
||||||
|
lab1: "AWX-Collection-tests-tower_job_template-lab1-{{ test_id }}"
|
||||||
wfjt_name: "AWX-Collection-tests-tower_workflow_job_template-wfjt-{{ test_id }}"
|
wfjt_name: "AWX-Collection-tests-tower_workflow_job_template-wfjt-{{ test_id }}"
|
||||||
email_not: "AWX-Collection-tests-tower_job_template-email-not-{{ test_id }}"
|
email_not: "AWX-Collection-tests-tower_job_template-email-not-{{ test_id }}"
|
||||||
webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ test_id }}"
|
webhook_not: "AWX-Collection-tests-tower_notification_template-wehbook-not-{{ test_id }}"
|
||||||
@@ -51,6 +52,11 @@
|
|||||||
state: present
|
state: present
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
|
- name: Create Label
|
||||||
|
tower_label:
|
||||||
|
name: "{{ lab1 }}"
|
||||||
|
organization: Default
|
||||||
|
|
||||||
- name: Create a Demo Project
|
- name: Create a Demo Project
|
||||||
tower_project:
|
tower_project:
|
||||||
name: "{{ demo_project_name }}"
|
name: "{{ demo_project_name }}"
|
||||||
@@ -117,6 +123,8 @@
|
|||||||
name: "{{ wfjt_name }}"
|
name: "{{ wfjt_name }}"
|
||||||
inventory: Demo Inventory
|
inventory: Demo Inventory
|
||||||
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
extra_vars: {'foo': 'bar', 'another-foo': {'barz': 'bar2'}}
|
||||||
|
labels:
|
||||||
|
- "{{ lab1 }}"
|
||||||
register: result
|
register: result
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
|
|||||||
Reference in New Issue
Block a user