mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 02:17:37 -02:30
add arguments to awxkit for webhooks on jt or wfjt
This commit is contained in:
committed by
Jeff Bradberry
parent
a4873d97d8
commit
d4c8167b1b
@@ -86,6 +86,8 @@ class JobTemplate(
|
|||||||
'vault_credential',
|
'vault_credential',
|
||||||
'verbosity',
|
'verbosity',
|
||||||
'job_slice_count',
|
'job_slice_count',
|
||||||
|
'webhook_service',
|
||||||
|
'webhook_credential',
|
||||||
'scm_branch')
|
'scm_branch')
|
||||||
|
|
||||||
update_payload(payload, optional_fields, kwargs)
|
update_payload(payload, optional_fields, kwargs)
|
||||||
@@ -102,6 +104,15 @@ class JobTemplate(
|
|||||||
payload.update(inventory=kwargs.get('inventory').id)
|
payload.update(inventory=kwargs.get('inventory').id)
|
||||||
if kwargs.get('credential'):
|
if kwargs.get('credential'):
|
||||||
payload.update(credential=kwargs.get('credential').id)
|
payload.update(credential=kwargs.get('credential').id)
|
||||||
|
if kwargs.get('webhook_credential'):
|
||||||
|
webhook_cred = kwargs.get('webhook_credential')
|
||||||
|
if isinstance(webhook_cred, int):
|
||||||
|
payload.update(webhook_credential=int(webhook_cred))
|
||||||
|
elif hasattr(webhook_cred, 'id'):
|
||||||
|
payload.update(webhook_credential=webhook_cred.id)
|
||||||
|
else:
|
||||||
|
raise AttributeError("Webhook credential must either be integer of pkid or Credential object")
|
||||||
|
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
def add_label(self, label):
|
def add_label(self, label):
|
||||||
|
|||||||
@@ -36,9 +36,15 @@ class WorkflowJobTemplate(HasCopy, HasCreate, HasNotifications, HasSurvey, Unifi
|
|||||||
|
|
||||||
optional_fields = (
|
optional_fields = (
|
||||||
"allow_simultaneous",
|
"allow_simultaneous",
|
||||||
"ask_variables_on_launch", "ask_inventory_on_launch", "ask_scm_branch_on_launch", "ask_limit_on_launch",
|
"ask_variables_on_launch",
|
||||||
"limit", "scm_branch",
|
"ask_inventory_on_launch",
|
||||||
"survey_enabled"
|
"ask_scm_branch_on_launch",
|
||||||
|
"ask_limit_on_launch",
|
||||||
|
"limit",
|
||||||
|
"scm_branch",
|
||||||
|
"survey_enabled",
|
||||||
|
"webhook_service",
|
||||||
|
"webhook_credential",
|
||||||
)
|
)
|
||||||
update_payload(payload, optional_fields, kwargs)
|
update_payload(payload, optional_fields, kwargs)
|
||||||
|
|
||||||
@@ -54,6 +60,15 @@ class WorkflowJobTemplate(HasCopy, HasCreate, HasNotifications, HasSurvey, Unifi
|
|||||||
if kwargs.get('inventory'):
|
if kwargs.get('inventory'):
|
||||||
payload.inventory = kwargs.get('inventory').id
|
payload.inventory = kwargs.get('inventory').id
|
||||||
|
|
||||||
|
if kwargs.get('webhook_credential'):
|
||||||
|
webhook_cred = kwargs.get('webhook_credential')
|
||||||
|
if isinstance(webhook_cred, int):
|
||||||
|
payload.update(webhook_credential=int(webhook_cred))
|
||||||
|
elif hasattr(webhook_cred, 'id'):
|
||||||
|
payload.update(webhook_credential=webhook_cred.id)
|
||||||
|
else:
|
||||||
|
raise AttributeError("Webhook credential must either be integer of pkid or Credential object")
|
||||||
|
|
||||||
return payload
|
return payload
|
||||||
|
|
||||||
def create_payload(self, name='', description='', organization=None, **kwargs):
|
def create_payload(self, name='', description='', organization=None, **kwargs):
|
||||||
|
|||||||
Reference in New Issue
Block a user