mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-23 08:21:49 -05:00
Co-authored-by: Christopher Wang <cwang@ansible.com> Co-authored-by: Jake McDermott <jmcdermott@ansible.com> Co-authored-by: Jim Ladd <jladd@redhat.com> Co-authored-by: Elijah DeLee <kdelee@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com> Co-authored-by: Yanis Guenane <yanis@guenane.org>
30 lines
912 B
Python
30 lines
912 B
Python
from awxkit.api.mixins import HasNotifications
|
|
from awxkit.api.pages import UnifiedJobTemplate
|
|
from awxkit.api.resources import resources
|
|
from . import page
|
|
|
|
|
|
class SystemJobTemplate(UnifiedJobTemplate, HasNotifications):
|
|
|
|
def launch(self, payload={}):
|
|
"""Launch the system_job_template using related->launch endpoint."""
|
|
result = self.related.launch.post(payload)
|
|
|
|
# return job
|
|
jobs_pg = self.get_related('jobs', id=result.json['system_job'])
|
|
assert jobs_pg.count == 1, \
|
|
"system_job_template launched (id:%s) but unable to find matching " \
|
|
"job at %s/jobs/" % (result.json['job'], self.url)
|
|
return jobs_pg.results[0]
|
|
|
|
|
|
page.register_page(resources.system_job_template, SystemJobTemplate)
|
|
|
|
|
|
class SystemJobTemplates(page.PageList, SystemJobTemplate):
|
|
|
|
pass
|
|
|
|
|
|
page.register_page(resources.system_job_templates, SystemJobTemplates)
|