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