Added instance_groups method to the awxkit models

Also added additional payload fields to the wfjt model.
This commit is contained in:
Oleksii Baranov 2022-09-15 13:36:58 +02:00 committed by Alan Rominger
parent 4579ab0d60
commit ffe970aee5
No known key found for this signature in database
GPG Key ID: C2D7EAAA12B63559
2 changed files with 15 additions and 6 deletions

View File

@ -48,10 +48,12 @@ class Schedules(page.PageList, Schedule):
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)
self.related.labels.post(dict(id=label.id))
def add_instance_group(self, instance_group):
with suppress(exc.NoContent):
self.related.instance_groups.post(dict(id=instance_group.id))
page.register_page([resources.schedules, resources.related_schedules], Schedules)

View File

@ -32,6 +32,11 @@ class WorkflowJobTemplateNode(HasCreate, base.Base):
'extra_data',
'identifier',
'all_parents_must_converge',
# prompt fields for JTs
'job_slice_count',
'forks',
'timeout',
'execution_environment',
)
update_payload(payload, optional_fields, kwargs)
@ -93,10 +98,12 @@ class WorkflowJobTemplateNode(HasCreate, base.Base):
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)
self.related.labels.post(dict(id=label.id))
def add_instance_group(self, instance_group):
with suppress(exc.NoContent):
self.related.instance_groups.post(dict(id=instance_group.id))
page.register_page(