Commit 567e4683 authored by Łukasz Nowak's avatar Łukasz Nowak

Avoid creation of hosting delivery during destruction.

Implement destroy_requested state and transition and mark as soon as possible
this state in case when software instance is being destroyed. In
SalePackingList_requestStoredSoftwareInstanceState support destroy_requested,
which in case of ongoing destruction is no-op.
parent 2c9fd689
...@@ -50,7 +50,10 @@ ...@@ -50,7 +50,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string># deliver proper packing list\n <value> <string>software_instance = state_change[\'object\']\n
# mark destroy is requested\n
software_instance.destroyRequested()\n
# deliver proper packing list\n
packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n
packing_list = packing_list_line.getParentValue()\n packing_list = packing_list_line.getParentValue()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'start\'):\n if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'start\'):\n
...@@ -59,7 +62,6 @@ if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_l ...@@ -59,7 +62,6 @@ if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_l
packing_list.deliver()\n packing_list.deliver()\n
\n \n
# revoke certificate\n # revoke certificate\n
software_instance = state_change[\'object\']\n
try:\n try:\n
context.getPortalObject().portal_certificate_authority\\\n context.getPortalObject().portal_certificate_authority\\\n
.revokeCertificate(software_instance.getDestinationReference())\n .revokeCertificate(software_instance.getDestinationReference())\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destroy_requested</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>destroy_computer_partition</string>
<string>destroy_requested</string>
<string>report_computer_partition_error</string>
<string>request_computer_partition</string>
<string>request_destroy_computer_partition</string>
<string>request_destroy_computer_partition_action</string>
<string>request_software_instance</string>
<string>request_start_computer_partition</string>
<string>request_start_computer_partition_action</string>
<string>request_stop_computer_partition</string>
<string>request_stop_computer_partition_action</string>
<string>start_computer_partition</string>
<string>start_computer_partition_installation</string>
<string>start_requested</string>
<string>stop_computer_partition</string>
<string>stop_computer_partition_installation</string>
<string>stop_requested</string>
<string>update_slave_partition_list</string>
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<value> <value>
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string>
<string>report_computer_partition_error</string> <string>report_computer_partition_error</string>
<string>request_computer_partition</string> <string>request_computer_partition</string>
<string>request_destroy_computer_partition</string> <string>request_destroy_computer_partition</string>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<value> <value>
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string>
<string>report_computer_partition_error</string> <string>report_computer_partition_error</string>
<string>request_computer_partition</string> <string>request_computer_partition</string>
<string>request_destroy_computer_partition</string> <string>request_destroy_computer_partition</string>
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
<value> <value>
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string>
<string>report_computer_partition_error</string> <string>report_computer_partition_error</string>
<string>request_computer_partition</string> <string>request_computer_partition</string>
<string>request_destroy_computer_partition</string> <string>request_destroy_computer_partition</string>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destroy_requested</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>destroy_requested</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
257 258
\ No newline at end of file \ No newline at end of file
...@@ -63,6 +63,8 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n ...@@ -63,6 +63,8 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n
software_instance.requestStartComputerPartition()\n software_instance.requestStartComputerPartition()\n
elif software_instance.getSlapState() == \'stop_requested\':\n elif software_instance.getSlapState() == \'stop_requested\':\n
software_instance.requestStopComputerPartition()\n software_instance.requestStopComputerPartition()\n
elif software_instance.getSlapState() == \'destroy_requested\':\n
software_instance.requestDestroyComputerPartition()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
382 383
\ 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