Commit 87cee04f authored by Romain Courteaud's avatar Romain Courteaud

Migrate software instance bang

parent 29f16200
446
447
\ No newline at end of file
......@@ -60,6 +60,7 @@
<string>_setTextContent</string>
<string>_setSourceReference</string>
<string>_setSlaXml</string>
<string>bang</string>
</list>
</value>
</item>
......
15
\ No newline at end of file
16
\ No newline at end of file
......@@ -50,24 +50,20 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n
<value> <string>instance = state_change[\'object\']\n
assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n
\n
root_hosting_subscription = portal.portal_catalog.getResultValue(uid=software_instance.SoftwareInstance_getRootHostingSubscriptionUid())\n
tag = \'%s_%s_inProgress\' % (software_instance.getUid(), root_hosting_subscription.getTitle())\n
root_software_instance = root_hosting_subscription.getPredecessorValue()\n
\n
# Use iterative algorithm instead of recursive approach in order to avoid\n
# complexity as much as possible.\n
flat_tree = [root_software_instance]\n
while flat_tree:\n
software_instance = flat_tree.pop(0)\n
flat_tree.extend(software_instance.getPredecessorValueList())\n
try:\n
software_instance.Item_getInstancePackingListLine(service_relative_url=portal.portal_preferences.getPreferredInstanceCleanupResource())\n
except ValueError:\n
#no instance cleanup, there is sense to try to update\n
software_instance.activate().requestUpdateComputerPartition()\n
if state_change.kwargs[\'bang_tree\']:\n
from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n
portal = instance.getPortalObject()\n
hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n
portal.portal_catalog.searchAndActivate(\n
specialise_uid=hosting_subscription.getUid(),\n
uid=NegatedQuery(Query(uid=instance.getUid())),\n
portal_type=["Slave Instance", "Software Instance"],\n
method_id=\'bang\',\n
method_kw={\'bang_tree\': False},\n
)\n
</string> </value>
</item>
<item>
......@@ -76,7 +72,11 @@ while flat_tree:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_bangSoftwareInstanceTree</string> </value>
<value> <string>RequestedInstance_bangInstanceTree</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -22,6 +22,7 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>bang</string>
<string>request_instance</string>
</tuple>
</value>
......
......@@ -23,6 +23,7 @@
<value>
<tuple>
<string>allocate_partition</string>
<string>bang</string>
<string>rename</string>
<string>request_destroy</string>
<string>request_instance</string>
......
......@@ -23,6 +23,7 @@
<value>
<tuple>
<string>allocate_partition</string>
<string>bang</string>
<string>rename</string>
<string>request_destroy</string>
<string>request_instance</string>
......
......@@ -24,7 +24,7 @@
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>SoftwareInstance_bangSoftwareInstanceTree</string> </value>
<value> <string>RequestedInstance_bangInstanceTree</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -38,7 +38,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>report_computer_partition_bang</string> </value>
<value> <string>bang</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
......@@ -46,7 +46,7 @@
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
<value> <string>Instance_checkConsistency</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
26
\ No newline at end of file
27
\ No newline at end of file
......@@ -734,8 +734,8 @@ class SlapTool(BaseTool):
"""
return self._getSoftwareInstanceForComputerPartition(
computer_id,
computer_partition_id).reportComputerPartitionBang(
comment=message)
computer_partition_id).bang(bang_tree=True,
comment=message)
@convertToREST
def _startedComputerPartition(self, computer_id, computer_partition_id):
......
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