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