Commit e8d307fe authored by Alain Takoudjou's avatar Alain Takoudjou

slapos_crm_monitoring: add error message in generated ticket for hosting subscription

parent 25d42cb4
portal = context.getPortalObject() portal = context.getPortalObject()
ticket_title = "Hosting Subscription %s is failing." % context.getTitle() ticket_title = "Hosting Subscription %s is failing." % context.getTitle()
error_message = instance.SoftwareInstance_hasReportedError(include_message=True)
description = "%s contains software instances which are unallocated or reporting errors." % ( description = "%s contains software instances which are unallocated or reporting errors." % (
context.getTitle()) context.getTitle())
if error_message:
description += "\n\nMessage: %s" % error_message
else:
error_message = "No message!"
support_request = context.Base_generateSupportRequestForSlapOS( support_request = context.Base_generateSupportRequestForSlapOS(
ticket_title, ticket_title,
...@@ -28,7 +33,8 @@ notification_message = portal.portal_notifications.getDocumentValue( ...@@ -28,7 +33,8 @@ notification_message = portal.portal_notifications.getDocumentValue(
reference=notification_reference) reference=notification_reference)
if notification_message is not None: if notification_message is not None:
mapping_dict = {'hosting_subscription_title':context.getTitle(), mapping_dict = {'hosting_subscription_title':context.getTitle(),
'instance': instance.getTitle()} 'instance': instance.getTitle(),
'error_text': error_message}
message = notification_message.asText( message = notification_message.asText(
substitution_method_parameter_dict={'mapping_dict':mapping_dict}) substitution_method_parameter_dict={'mapping_dict':mapping_dict})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment