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

Migrate software instance bang

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