Commit f369004a authored by Guillaume Hervier's avatar Guillaume Hervier

slapos_crm: Add Notification Messages for broken and outdated instances.

parent 36698874
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Notification Message" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>function/production</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>outdated-instance-en</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>outdated_instance_en</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Notification Message</string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>Hello ${owner_name},\n
\n
Your instance ${instance_name} is outdated and should be upgrade to the latest available Software Release version.\n
\n
In order to guarantee the integrity and stability of resilient instances, it’s necessary for them to be regularly updated to get the latest features and bug fixes, then simplifying their maintenance.\n
For this, you need to take one of the following actions:\n
\n
- Check if your instance is still used, as it’s not necessary to keep unused instances, and either destroy or stop it if that’s the case.\n
- Check your tickets corresponding to “Upgrade Decisions” for your instances and accept them (if there is multiples tickets, you only need to accept the latest one corresponding to the latest SR version)\n
The latest one found is: ${preferred_slapos_web_site_url}/#/${upgrade_decision_path}\n
\n
Without news or actions until three working days, we won’t guarantee the instance’s integrity anymore.\n
Also don’t hesitate to contact me in case of problems or questions.\n
\n
Support Team</string> </value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>Event_getOutdatedHostingSubscriptionData</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Outdated instance</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Notification Message" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>function/production</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>outdated-instance-fr</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>outdated_instance_fr</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>fr</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Notification Message</string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>Bonjour ${owner_name},\n
\n
Votre instance ${instance_name} n\'est pas à la dernière version de la Software Release disponible.\n
\n
Or afin de garantir une intégrité et une stabilité des instances, il est nécessaire que celles-ci soient régulièrement mise à jour afin qu’elles puissent profiter des dernières fonctionnalités et correction de bugs, simplifiant ainsi leur maintenance.\n
De ce fait, il est nécessaire que vous effectuez une des actions suivantes:\n
\n
- Vérifier que votre instance est toujours utilisée, étant nécessaire de ne pas garder des instances qui ne sont plus utilisées, et de soit détruire l’instance en question ou la stopper le cas étant.\n
- Consulter les tickets correspondant aux “Upgrade Decision” conçernant vos instances et que vous les acceptiez (s’il y en a plusieurs, il n’est nécessaire que d’accepter la dernière en date correspondant à la dernière version disponible pour l’instance)\n
La dernière trouvée étant: ${preferred_slapos_web_site_url}/#/${upgrade_decision_path}\n
\n
Sans nouvelles ou actions de votre part d’ici trois jours, nous ne garantirons plus l’intégrité de votre instance.\n
N’hésitez pas à revenir vers moi en cas de problèmes ou de questions.\n
\n
PS: Lorsqu’un ticket “Upgrade Decision” est accepté et complété, l’instance correspondante nécessite [pour le moment] d’être redémarrée afin que la mise à jour s’applique (il faut stopper l’instance et la redémarrer une fois complètement stoppée pour cela)\n
\n
Support Team</string> </value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>Event_getOutdatedHostingSubscriptionData</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Instance dépréciée</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Notification Message" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>function/production</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>slapos-broken-instance-en</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_broken_instance_en</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Notification Message</string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>Hello ${owner_name},\n
\n
Your instance ${instance_name} seems to not instanciate correctly anymore in resiliency due to an error in the process of compilation or instantiation.\n
This problem come from incorrect buildout files.\n
\n
In order to guarantee the integrity and stability of resilient instances, it\'s necessary for them to be constantly capable of being rebuilt without errors.\n
For this, you need to correct the errors on your instancel, displayed on your monitoring interface available at the URL on slapos.vifib.com UI.\n
\n
Without news or actions until three working days, we won’t guarantee the instance’s integrity anymore.\n
Also don’t hesitate to contact me in case of problems or questions.\n
\n
Support Team</string> </value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>Event_getHostingSubscriptionData</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Your instance is broken</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Notification Message" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>function/production</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_md5</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/plain</string> </value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>slapos-broken-instance-fr</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_broken_instance_fr</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value> <string>fr</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Notification Message</string> </value>
</item>
<item>
<key> <string>text_content</string> </key>
<value> <string>Bonjour ${owner_name},\n
\n
Votre instance ${instance_name} semble ne plus correctement s\'instancier en résilience suite à une erreur dans le processus de compilation et/ou d\'instanciation.\n
Ce problème provient des fichiers buildout qui sont incorrects.\n
\n
Afin de garantir une intégrité et une stabilité des instances résilientes, il est nécessaire que celles-ci soient constamment en état d’être reconstruite sans erreur.\n
De ce fait, il faut que vous corrigiez les erreurs présentes sur vos instances, celles-ci étant affichées sur votre interface de monitoring disponible à l’URL indiquée sur slapos.vifib.com.\n
\n
Sans nouvelles ou actions de votre part d’ici trois jours, nous ne garantirons plus l’intégrité de votre instance.\n
N’hésitez pas à revenir vers moi en cas de problèmes ou de questions.\n
\n
Support Team</string> </value>
</item>
<item>
<key> <string>text_content_substitution_mapping_method_id</string> </key>
<value> <string>Event_getHostingSubscriptionData</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Votre instance est cassée</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>001</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if event_value is None:
event_value = context
support_request = event_value.getFollowUpValue()
hosting_subscription = support_request.getAggregateValue()
if hosting_subscription is None:
return {}
owner = hosting_subscription.getDestinationSectionValue()
return {
"owner_name": owner.getFirstName(),
"instance_name": hosting_subscription.getTitle(),
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>event_value=None, **kwargs</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Event_getHostingSubscriptionData</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
if event_value is None:
event_value = context
support_request = event_value.getFollowUpValue()
hosting_subscription = support_request.getAggregateValue()
if hosting_subscription is None:
return {}
upgrade_decision_list = hosting_subscription.getAggregateRelatedValueList(
portal_type='Upgrade Decision Line',
sort_by='start_date DESC',
limit=1,
)
upgrade_decision_path = upgrade_decision_list[0].getParent().getRelativeUrl()
preferred_slapos_web_site_url = portal.portal_preferences.getPreferredSlaposWebSiteUrl()
owner = hosting_subscription.getDestinationSectionValue()
return {
"owner_name": owner.getFirstName(),
"instance_name": hosting_subscription.getTitle(),
"upgrade_decision_path": upgrade_decision_path,
"preferred_slapos_web_site_url": preferred_slapos_web_site_url,
}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>