mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 23:12:08 -03:30
Add new add_label method to the wfjt node and schedules awxkit models
This commit is contained in:
parent
efeeeefd4c
commit
4579ab0d60
@ -47,6 +47,12 @@ class Schedules(page.PageList, Schedule):
|
||||
with suppress(exc.NoContent):
|
||||
self.related.credentials.post(dict(id=cred.id, disassociate=True))
|
||||
|
||||
def add_label(self, label):
|
||||
if isinstance(label, page.Page):
|
||||
label = label.json
|
||||
with suppress(exc.NoContent):
|
||||
self.related.labels.post(label)
|
||||
|
||||
|
||||
page.register_page([resources.schedules, resources.related_schedules], Schedules)
|
||||
|
||||
|
||||
@ -92,6 +92,12 @@ class WorkflowJobTemplateNode(HasCreate, base.Base):
|
||||
candidates = workflow_job.get_related('workflow_nodes', identifier=self.identifier)
|
||||
return candidates.results.pop()
|
||||
|
||||
def add_label(self, label):
|
||||
if isinstance(label, page.Page):
|
||||
label = label.json
|
||||
with suppress(exc.NoContent):
|
||||
self.related.labels.post(label)
|
||||
|
||||
|
||||
page.register_page(
|
||||
[resources.workflow_job_template_node, (resources.workflow_job_template_nodes, 'post'), (resources.workflow_job_template_workflow_nodes, 'post')],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user