Commit e6e8d33a authored by Antoine Catton's avatar Antoine Catton

Add renaming support in SlapTool

This avoid renamed instances in transitionnal state to be runned by
slapgrid-cp.
parent d30c9963
......@@ -455,6 +455,7 @@ class SlapTool(BaseTool):
update_movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document, service_uid_list=[portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()])
renamed = False
if update_movement is not None:
if update_movement.getSimulationState() != 'confirmed':
# only confirmed update movements are interesting
......@@ -462,6 +463,13 @@ class SlapTool(BaseTool):
movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document)
if movement is not None:
# XXX-Antoine: support renaming
software_instance = movement.getAggregateValue(portal_type="Software Instance")
hosting_subscription = movement.getAggregateValue(portal_type="Hosting Subscription")
if software_instance in hosting_subscription.getPredecessorValueList() and \
software_instance.getTitle() != hosting_subscription.getTitle():
renamed = True
software_release_document = \
movement.getAggregateValue(portal_type='Software Release')
slap_partition._software_release_document = SoftwareRelease(
......@@ -532,6 +540,10 @@ class SlapTool(BaseTool):
else:
raise NotImplementedError, "Unexpected resource%s" % \
movement.getResource()
if renamed and slap_partition._requested_state != 'destroyed':
slap_partition._need_modification = 0
return slap_partition
def _hasSlaveInstanceNeedModification(self, computer_partition_document):
......
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