Commit 1dbb15ae authored by Romain Courteaud's avatar Romain Courteaud

Prevent allocating slave on stopped/destroyed instance.

parent f24f54d2
......@@ -65,7 +65,7 @@ elif slap_state == \'busy\':\n
validation_state="validated",\n
default_aggregate_uid=context.getUid(),\n
)\n
if instance is None:\n
if (instance is None) or (instance.getSlapState() == "start_requested"):\n
return []\n
else:\n
return [instance.getRootSoftwareReleaseUrl()]\n
......
......@@ -55,7 +55,7 @@
validation_state="validated",\n
default_aggregate_uid=context.getUid(),\n
)\n
if instance is None:\n
if (instance is None) or (instance.getSlapState() == "start_requested"):\n
return ""\n
else:\n
return instance.getSourceReference()\n
......
458
\ No newline at end of file
459
\ No newline at end of file
......@@ -27,15 +27,15 @@
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>SalePackingList_reindexUnderDestructionComputerPartition</string>
</list>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
<list>
<string>SoftwareInstance_reindexComputerPartition</string>
</list>
</value>
</item>
<item>
......@@ -50,16 +50,15 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_changeDestructionState</string> </value>
<value> <string>SoftwareInstance_changeState</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>confirm</string>
<string>start</string>
<string>stop</string>
<string>deliver</string>
<string>requestStart</string>
<string>requestStop</string>
<string>requestDestroy</string>
</list>
</value>
</item>
......@@ -71,7 +70,7 @@
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Sale Packing List</string>
<string>Software Instance</string>
</list>
</value>
</item>
......
......@@ -50,20 +50,11 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, NegatedQuery\n
\n
current_delivery = state_change[\'object\']\n
portal = current_delivery.getPortalObject()\n
\n
destroy_service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()\n
\n
sale_packing_list_line_list = current_delivery.contentValues(portal_type="Sale Packing List Line")\n
for current_delivery_line in sale_packing_list_line_list:\n
if current_delivery_line.getResource() == destroy_service_relative_url:\n
\n
computer_partition = current_delivery_line.getAggregateValue(portal_type=["Computer Partition"])\n
computer_partition.activate(\n
after_path_and_method_id=(current_delivery.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n
<value> <string>instance = state_change[\'object\']\n
partition = instance.getAggregateValue(portal_type="Computer Partition")\n
if computer_partition is not None:\n
computer_partition.activate(\n
after_path_and_method_id=(instance.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n
</string> </value>
</item>
<item>
......@@ -80,7 +71,7 @@ for current_delivery_line in sale_packing_list_line_list:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_reindexUnderDestructionComputerPartition</string> </value>
<value> <string>SoftwareInstance_reindexComputerPartition</string> </value>
</item>
</dictionary>
</pickle>
......
757
\ No newline at end of file
758
\ No newline at end of file
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