Commit f3462719 authored by Romain Courteaud's avatar Romain Courteaud

Master is now stateless.

Slaptool should not try to update Packing List state.
parent 3f7f72cc
...@@ -909,36 +909,16 @@ class SlapTool(BaseTool): ...@@ -909,36 +909,16 @@ class SlapTool(BaseTool):
@convertToREST @convertToREST
def _buildingComputerPartition(self, computer_id, computer_partition_id): def _buildingComputerPartition(self, computer_id, computer_partition_id):
""" """
Reports that Computer Partition is being build Kept for compatibility
""" """
instance = self._getSoftwareInstanceForComputerPartition( pass
computer_id,
computer_partition_id)
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])
if delivery is not None:
portal = self.getPortalObject()
line = delivery.contentValues(portal_type="Sale Packing List Line")[0]
if line.getResource() == portal.portal_preferences.\
getPreferredInstanceSetupResource():
if portal.portal_workflow.isTransitionPossible(delivery, 'start'):
delivery.start()
@convertToREST @convertToREST
def _availableComputerPartition(self, computer_id, computer_partition_id): def _availableComputerPartition(self, computer_id, computer_partition_id):
""" """
Reports that Computer Partition is available Kept for compatibility
""" """
instance = self._getSoftwareInstanceForComputerPartition( pass
computer_id,
computer_partition_id)
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])
if delivery is not None:
portal = self.getPortalObject()
line = delivery.contentValues(portal_type="Sale Packing List Line")[0]
if line.getResource() == portal.portal_preferences.\
getPreferredInstanceSetupResource():
if portal.portal_workflow.isTransitionPossible(delivery, 'stop'):
delivery.stop()
@convertToREST @convertToREST
def _softwareInstanceError(self, computer_id, def _softwareInstanceError(self, computer_id,
...@@ -1021,38 +1001,16 @@ class SlapTool(BaseTool): ...@@ -1021,38 +1001,16 @@ class SlapTool(BaseTool):
@convertToREST @convertToREST
def _startedComputerPartition(self, computer_id, computer_partition_id): def _startedComputerPartition(self, computer_id, computer_partition_id):
""" """
Reports that Computer Partition is started Kept for compatibility
""" """
instance = self._getSoftwareInstanceForComputerPartition( pass
computer_id,
computer_partition_id)
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])
if delivery is not None:
portal = self.getPortalObject()
line = delivery.contentValues(portal_type="Sale Packing List Line")[0]
if line.getResource() in [
portal.portal_preferences.getPreferredInstanceHostingResource(),
portal.portal_preferences.getPreferredInstanceUpdateResource()]:
if portal.portal_workflow.isTransitionPossible(delivery, 'start'):
delivery.start()
@convertToREST @convertToREST
def _stoppedComputerPartition(self, computer_id, computer_partition_id): def _stoppedComputerPartition(self, computer_id, computer_partition_id):
""" """
Reports that Computer Partition is stopped Kept for compatibility
""" """
instance = self._getSoftwareInstanceForComputerPartition( pass
computer_id,
computer_partition_id)
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])
if delivery is not None:
portal = self.getPortalObject()
line = delivery.contentValues(portal_type="Sale Packing List Line")[0]
if line.getResource() in [
portal.portal_preferences.getPreferredInstanceHostingResource(),
portal.portal_preferences.getPreferredInstanceUpdateResource()]:
if portal.portal_workflow.isTransitionPossible(delivery, 'stop'):
delivery.stop()
@convertToREST @convertToREST
def _destroyedComputerPartition(self, computer_id, computer_partition_id): def _destroyedComputerPartition(self, computer_id, computer_partition_id):
...@@ -1071,20 +1029,11 @@ class SlapTool(BaseTool): ...@@ -1071,20 +1029,11 @@ class SlapTool(BaseTool):
) )
if instance.getValidationState() == 'validated': if instance.getValidationState() == 'validated':
instance.invalidate() instance.invalidate()
delivery = instance.getCausalityValue(portal_type=["Sale Packing List"])
if delivery is not None:
portal = self.getPortalObject()
line = delivery.contentValues(portal_type="Sale Packing List Line")[0]
if line.getResource() in [
portal.portal_preferences.getPreferredInstanceCleanupResource()]:
if portal.portal_workflow.isTransitionPossible(delivery, 'stop'):
delivery.stop()
if portal.portal_workflow.isTransitionPossible(delivery, 'deliver'):
delivery.deliver()
# XXX Integrate with REST API # XXX Integrate with REST API
# Code duplication will be needed until SlapTool is removed # Code duplication will be needed until SlapTool is removed
# revoke certificate # revoke certificate
portal = self.getPortalObject()
try: try:
portal.portal_certificate_authority\ portal.portal_certificate_authority\
.revokeCertificate(instance.getDestinationReference()) .revokeCertificate(instance.getDestinationReference())
......
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