mirror of
https://github.com/ansible/awx.git
synced 2024-10-30 13:55:31 +03:00
Add support for messages field in awxkit
This commit is contained in:
parent
cb411cc3be
commit
616db6bc51
@ -48,7 +48,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base):
|
||||
except (exc.MethodNotAllowed):
|
||||
pass
|
||||
|
||||
def payload(self, organization, notification_type='slack', **kwargs):
|
||||
def payload(self, organization, notification_type='slack', messages=not_provided, **kwargs):
|
||||
payload = PseudoNamespace(
|
||||
name=kwargs.get('name') or 'NotificationTemplate ({0}) - {1}' .format(
|
||||
notification_type,
|
||||
@ -56,6 +56,8 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base):
|
||||
description=kwargs.get('description') or random_title(10),
|
||||
organization=organization.id,
|
||||
notification_type=notification_type)
|
||||
if messages != not_provided:
|
||||
payload['messages'] = messages
|
||||
|
||||
notification_configuration = kwargs.get(
|
||||
'notification_configuration', {})
|
||||
@ -129,6 +131,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base):
|
||||
description='',
|
||||
notification_type='slack',
|
||||
organization=Organization,
|
||||
messages=not_provided,
|
||||
**kwargs):
|
||||
if notification_type not in notification_types:
|
||||
raise ValueError(
|
||||
@ -140,6 +143,7 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base):
|
||||
notification_type=notification_type,
|
||||
name=name,
|
||||
description=description,
|
||||
messages=messages,
|
||||
**kwargs)
|
||||
payload.ds = DSAdapter(self.__class__.__name__, self._dependency_store)
|
||||
return payload
|
||||
@ -150,12 +154,14 @@ class NotificationTemplate(HasCopy, HasCreate, base.Base):
|
||||
description='',
|
||||
notification_type='slack',
|
||||
organization=Organization,
|
||||
messages=not_provided,
|
||||
**kwargs):
|
||||
payload = self.create_payload(
|
||||
name=name,
|
||||
description=description,
|
||||
notification_type=notification_type,
|
||||
organization=organization,
|
||||
messages=messages,
|
||||
**kwargs)
|
||||
return self.update_identity(
|
||||
NotificationTemplates(
|
||||
|
Loading…
Reference in New Issue
Block a user