Commit bbc1e712 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Display correct information when the ticket is related to Software Installation

parent 2c614cd2
...@@ -8,14 +8,9 @@ ...@@ -8,14 +8,9 @@
from DateTime import DateTime from DateTime import DateTime
import json import json
from Products.ERP5Type.DateUtils import addToDate
if context.getSimulationState() == "invalidated": if context.getSimulationState() == "invalidated":
return "Closed Ticket" return "Closed Ticket"
portal = context.getPortalObject()
document = context.getAggregateValue() document = context.getAggregateValue()
if document is None: if document is None:
...@@ -39,6 +34,29 @@ if aggregate_portal_type == "Computer": ...@@ -39,6 +34,29 @@ if aggregate_portal_type == "Computer":
except KeyError: except KeyError:
return "No Contact Information" return "No Contact Information"
if aggregate_portal_type == "Software Installation":
computer_title = document.getAggregateTitle()
if document.getSlapState() not in ["start_requested", "stop_requested"]:
return "Software Installation is Destroyed."
try:
d = memcached_dict[document.getReference()]
d = json.loads(d)
last_contact = DateTime(d.get('created_at'))
if d.get("text").startswith("building"):
return "The software release %s is building for mode them 12 hours on %s, started on %s" % \
(document.getUrlString(), computer_title, document.getCreationDate())
elif d.get("text").startswith("#access"):
return "All OK, software built."
elif d.get("text").startswith("#error"):
return "The software release %s is failing to build for too long on %s, started on %s" % \
(document.getUrlString(), computer_title, document.getCreationDate())
except KeyError:
return "The software release %s did not started to build on %s since %s" % \
(document.getUrlString(), computer_title, document.getCreationDate())
if aggregate_portal_type == "Hosting Subscription": if aggregate_portal_type == "Hosting Subscription":
message_list = [] message_list = []
hosting_subscription = document hosting_subscription = document
...@@ -46,17 +64,12 @@ if aggregate_portal_type == "Hosting Subscription": ...@@ -46,17 +64,12 @@ if aggregate_portal_type == "Hosting Subscription":
software_instance_list = hosting_subscription.getSpecialiseRelatedValueList( software_instance_list = hosting_subscription.getSpecialiseRelatedValueList(
portal_type=["Software Instance", "Slave Instance"]) portal_type=["Software Instance", "Slave Instance"])
has_newest_allocated_instance = False
has_unallocated_instance = False
failing_instance = None
# Check if at least one software Instance is Allocated # Check if at least one software Instance is Allocated
for instance in software_instance_list: for instance in software_instance_list:
if instance.getSlapState() not in ["start_requested", "stop_requested"]: if instance.getSlapState() not in ["start_requested", "stop_requested"]:
continue continue
if instance.getAggregate() is not None: if instance.getAggregate() is not None:
has_newest_allocated_instance = True
computer = instance.getAggregateValue().getParentValue() computer = instance.getAggregateValue().getParentValue()
if instance.getPortalType() == "Software Instance" and \ if instance.getPortalType() == "Software Instance" and \
computer.getAllocationScope() in ["open/public", "open/friend"] and \ computer.getAllocationScope() in ["open/public", "open/friend"] and \
......
...@@ -106,6 +106,10 @@ ...@@ -106,6 +106,10 @@
<string>Hosting Subscription</string> <string>Hosting Subscription</string>
<string>Hosting Subscription</string> <string>Hosting Subscription</string>
</tuple> </tuple>
<tuple>
<string>Software Installation</string>
<string>Software Installation</string>
</tuple>
</list> </list>
</value> </value>
</item> </item>
......
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