Commit 77968c0b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_crm: Only raise tickets for started instances

Stop or Destroyed instances don't required checks.
parent 8e4169d6
...@@ -37,6 +37,7 @@ for instance in software_instance_list: ...@@ -37,6 +37,7 @@ for instance in software_instance_list:
has_newest_allocated_instance = True has_newest_allocated_instance = True
if instance.getPortalType() == "Software Instance" and \ if instance.getPortalType() == "Software Instance" and \
computer_partition.getParentValue().getAllocationScope() in ["open/friend", "open/public"] and \ computer_partition.getParentValue().getAllocationScope() in ["open/friend", "open/public"] and \
instance.getSlapState() == "start_requested" and \
instance.SoftwareInstance_hasReportedError(): instance.SoftwareInstance_hasReportedError():
return context.HostingSubscription_createSupportRequestEvent( return context.HostingSubscription_createSupportRequestEvent(
instance, 'slapos-crm-hosting-subscription-instance-state.notification') instance, 'slapos-crm-hosting-subscription-instance-state.notification')
......
...@@ -55,17 +55,18 @@ if aggregate_portal_type == "Hosting Subscription": ...@@ -55,17 +55,18 @@ if aggregate_portal_type == "Hosting Subscription":
if instance.getSlapState() not in ["start_requested", "stop_requested"]: if instance.getSlapState() not in ["start_requested", "stop_requested"]:
continue continue
if instance.getAggregateValue() is not None: if instance.getAggregate() is not None:
has_newest_allocated_instance = True 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 \
instance.getSlapState() == "start_requested" and \
instance.SoftwareInstance_hasReportedError(): instance.SoftwareInstance_hasReportedError():
message_list.append("%s has error (%s, %s at %s scope %s)" % (instance.getReference(), instance.getTitle(), message_list.append("%s has error (%s, %s at %s scope %s)" % (instance.getReference(), instance.getTitle(),
instance.getUrlString(), computer.getReference(), instance.getUrlString(), computer.getReference(),
computer.getAllocationScope())) computer.getAllocationScope()))
if instance.getPortalType() == "Software Instance" and \ if instance.getPortalType() == "Software Instance" and \
instance.getAggregateValue().getParentValue().getAllocationScope() in ["closed/outdated", "open/personal"]: computer.getAllocationScope() in ["closed/outdated", "open/personal"]:
message_list.append("%s on a %s computer" % (instance, computer.getAllocationScope()) ) message_list.append("%s on a %s computer" % (instance, computer.getAllocationScope()) )
else: else:
message_list.append("%s is not allocated" % instance) message_list.append("%s is not allocated" % instance)
......
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