Commit 433fdc76 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: do not create event if the ticket exists

- drop Base_getSupportRequestInProgress
- drop SupportRequest_getLastEvent
parent d51fc308
portal = context.getPortalObject()
return portal.portal_catalog.getResultValue(
portal_type='Support Request',
title={'query': title, 'key': 'ExactMatch'},
simulation_state=["validated", "submitted", "suspended"],
causality__uid=context.getUid(),
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>title</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getSupportRequestInProgress</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -65,8 +65,6 @@ for software_installation in software_installation_list: ...@@ -65,8 +65,6 @@ for software_installation in software_installation_list:
return return
notification_message_reference = 'slapos-crm-compute_node_software_installation_state.notification' notification_message_reference = 'slapos-crm-compute_node_software_installation_state.notification'
event = support_request.SupportRequest_getLastEvent(ticket_title)
if event is None:
support_request.Ticket_createProjectEvent( support_request.Ticket_createProjectEvent(
ticket_title, 'outgoing', 'Web Message', ticket_title, 'outgoing', 'Web Message',
portal.service_module.slapos_crm_information.getRelativeUrl(), portal.service_module.slapos_crm_information.getRelativeUrl(),
......
...@@ -76,10 +76,7 @@ if not should_notify: ...@@ -76,10 +76,7 @@ if not should_notify:
context.getTitle(), context.getReference(), last_contact) context.getTitle(), context.getReference(), last_contact)
if should_notify: if should_notify:
support_request = context.Base_getSupportRequestInProgress(
title=node_ticket_title)
if support_request is None:
project = context.getFollowUpValue() project = context.getFollowUpValue()
support_request = project.Project_createSupportRequestWithCausality( support_request = project.Project_createSupportRequestWithCausality(
ticket_title, ticket_title,
...@@ -91,8 +88,6 @@ if should_notify: ...@@ -91,8 +88,6 @@ if should_notify:
if support_request is None: if support_request is None:
return return
event = support_request.SupportRequest_getLastEvent(ticket_title)
if event is None:
support_request.Ticket_createProjectEvent( support_request.Ticket_createProjectEvent(
ticket_title, 'outgoing', 'Web Message', ticket_title, 'outgoing', 'Web Message',
portal.service_module.slapos_crm_information.getRelativeUrl(), portal.service_module.slapos_crm_information.getRelativeUrl(),
......
...@@ -58,8 +58,6 @@ for instance in software_instance_list: ...@@ -58,8 +58,6 @@ for instance in software_instance_list:
if support_request is None: if support_request is None:
return return
event = support_request.SupportRequest_getLastEvent(ticket_title)
if event is None:
support_request.Ticket_createProjectEvent( support_request.Ticket_createProjectEvent(
ticket_title, 'outgoing', 'Web Message', ticket_title, 'outgoing', 'Web Message',
portal.service_module.slapos_crm_information.getRelativeUrl(), portal.service_module.slapos_crm_information.getRelativeUrl(),
......
...@@ -3,7 +3,12 @@ project = context ...@@ -3,7 +3,12 @@ project = context
causality_value = portal.restrictedTraverse(causality) causality_value = portal.restrictedTraverse(causality)
if causality_value.Base_getSupportRequestInProgress(title=title) is not None: if portal.portal_catalog.getResultValue(
portal_type='Support Request',
title={'query': title, 'key': 'ExactMatch'},
simulation_state=["validated", "submitted", "suspended"],
causality__uid=causality_value.getUid(),
) is not None:
return return
destination_decision_value = portal.restrictedTraverse(destination_decision) destination_decision_value = portal.restrictedTraverse(destination_decision)
......
portal = context.getPortalObject()
return portal.portal_catalog.getResultValue(
title={'query': title, 'key': 'ExactMatch'},
follow_up__uid=context.getUid(),
portal_type=portal.getPortalEventTypeList(),
sort_on=[('delivery.start_date', 'DESC')])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>title</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SupportRequest_getLastEvent</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -16,9 +16,7 @@ if document.getSlapState() == "destroy_requested": ...@@ -16,9 +16,7 @@ if document.getSlapState() == "destroy_requested":
""" """
ticket_title = "Instance Tree was destroyed was destroyed by the user" ticket_title = "Instance Tree was destroyed was destroyed by the user"
event = context.SupportRequest_getLastEvent(ticket_title) event = context.Ticket_createProjectEvent(
if event is None:
context.Ticket_createProjectEvent(
ticket_title, 'outgoing', 'Web Message', ticket_title, 'outgoing', 'Web Message',
portal.service_module.slapos_crm_information.getRelativeUrl(), portal.service_module.slapos_crm_information.getRelativeUrl(),
text_content=message, text_content=message,
......
...@@ -113,7 +113,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template): ...@@ -113,7 +113,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_cloud/SoftwareRelease_getRelatedNetworkList', 'slapos_cloud/SoftwareRelease_getRelatedNetworkList',
'slapos_cloud/SoftwareRelease_getUsableComputeNodeList', 'slapos_cloud/SoftwareRelease_getUsableComputeNodeList',
'slapos_cloud/SoftwareInstance_viewRenameAndRequestDestroyAction', 'slapos_cloud/SoftwareInstance_viewRenameAndRequestDestroyAction',
'slapos_cloud/Base_getSupportRequestInProgress',
'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency', 'slapos_cloud/SoftwareInstance_checkDuplicationOnInstanceTreeConsistency',
'slapos_cloud/ComputerNetwork_getRelatedSoftwareReleaseList', 'slapos_cloud/ComputerNetwork_getRelatedSoftwareReleaseList',
'slapos_crm_monitoring/ComputeNode_checkInstanceOnCloseAllocation', 'slapos_crm_monitoring/ComputeNode_checkInstanceOnCloseAllocation',
...@@ -125,7 +124,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template): ...@@ -125,7 +124,6 @@ def makeTestSlapOSCodingStyleTestCase(tested_business_template):
'slapos_crm_monitoring/SupportRequest_getMonitorUrl', 'slapos_crm_monitoring/SupportRequest_getMonitorUrl',
'slapos_crm_monitoring/SupportRequest_recheckMonitoring', 'slapos_crm_monitoring/SupportRequest_recheckMonitoring',
'slapos_crm_monitoring/Event_checkCustomerAsSourceOrDestinationConsistency', 'slapos_crm_monitoring/Event_checkCustomerAsSourceOrDestinationConsistency',
'slapos_crm_monitoring/SupportRequest_getLastEvent',
'slapos_crm_monitoring/Project_createSupportRequestWithCausality', 'slapos_crm_monitoring/Project_createSupportRequestWithCausality',
'slapos_crm/RegularisationRequest_afterClone', 'slapos_crm/RegularisationRequest_afterClone',
'slapos_crm/RegularisationRequest_getResourceItemList', 'slapos_crm/RegularisationRequest_getResourceItemList',
......
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