Commit e6d1a320 authored by Gabriel Monnerat's avatar Gabriel Monnerat

merge 'master' into slave_instance

parents 0f0da06d 567e4683
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>unfiltered_tracking_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Item Tracking</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Item_viewTrackingList?current:int=0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>unfiltered_tracking_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Item Tracking</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Item_viewTrackingList?current:int=0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -50,8 +50,18 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string># revoke certificate\n
software_instance = state_change[\'object\']\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 = packing_list_line.getParentValue()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'start\'):\n
packing_list.start()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'deliver\'):\n
packing_list.deliver()\n
\n
# revoke certificate\n
try:\n
context.getPortalObject().portal_certificate_authority\\\n
.revokeCertificate(software_instance.getDestinationReference())\n
......@@ -66,14 +76,6 @@ software_instance.edit(\n
ssl_key=None,\n
ssl_certificate=None,\n
)\n
\n
# deliver proper packing list\n
packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n
packing_list = packing_list_line.getParentValue()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'start\'):\n
packing_list.start()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'deliver\'):\n
packing_list.deliver()\n
</string> </value>
</item>
<item>
......
<?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 @@
<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>
......
......@@ -23,6 +23,7 @@
<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>
......
......@@ -23,6 +23,7 @@
<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>
......
<?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>
Computer Partition | unfiltered_tracking_list
Person | get_certificate
Person | revoke_certificate
Slave Instance | jump_to_software_instance
Slave Instance | view
Slave Instance | web_view
Software Instance Module | view
Software Instance | jump_to_software_instance
Software Instance | unfiltered_tracking_list
Software Instance | view
Software Instance | web_view
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>unfiltered_tracking_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>2.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Item Tracking</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Item_viewTrackingList?current:int=0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Hosting Subscription Module | view
Hosting Subscription | unfiltered_tracking_list
Hosting Subscription | view
\ No newline at end of file
......@@ -79,7 +79,8 @@ software_instance = current_delivery_line.getAggregateValue(portal_type="Softwar
for sale_packing_list_line in portal.portal_catalog(\n
portal_type="Sale Packing List Line", \n
default_aggregate_uid=software_instance.getUid(),\n
simulation_state=NegatedQuery(Query(simulation_state="delivered")),):\n
simulation_state=NegatedQuery(Query(simulation_state=["delivered", "cancelled"])),\n
):\n
sale_packing_list = sale_packing_list_line.getParentValue()\n
if isTransitionPossible(sale_packing_list, \'start\'):\n
sale_packing_list.start()\n
......
......@@ -63,6 +63,8 @@ if resource == preference_tool.getPreferredInstanceSetupResource():\n
software_instance.requestStartComputerPartition()\n
elif software_instance.getSlapState() == \'stop_requested\':\n
software_instance.requestStopComputerPartition()\n
elif software_instance.getSlapState() == \'destroy_requested\':\n
software_instance.requestDestroyComputerPartition()\n
</string> </value>
</item>
<item>
......
......@@ -314,6 +314,17 @@ class TestVifibSlapWebService(testVifibMixin):
self.portal.portal_preferences.getPreferredInstanceHostingResource(),
sequence)
def stepCheckComputerPartitionNoInstanceHostingSalePackingList(self,
sequence, **kw):
computer_partition = self.portal.portal_catalog.getResultValue(
uid=sequence['computer_partition_uid'])
delivery_line_list = [q for q in computer_partition
.getAggregateRelatedValueList(
portal_type=self.sale_packing_list_line_portal_type)
if q.getResource() == self.\
portal.portal_preferences.getPreferredInstanceHostingResource()]
self.assertEqual(0, len(delivery_line_list))
def stepCheckComputerPartitionInstanceHostingSalePackingListDelivered(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('delivered',
......@@ -9189,6 +9200,97 @@ class TestVifibSlapWebService(testVifibMixin):
Software Instances deployed on many computers"""
raise NotImplementedError
def test_bug_destruction_confirmed_instance_setup(self):
"""Proves that all is correctly handled in case of confirmed instance
setup packing list existence"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + \
"""
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
# Now there are two packing lists in confirmed state:
# * one for instance setup
# * one for instance destruction
# Simulate typical scenario:
# * stopped
# * commit
# * destroyed
# * commit
# * tic
SlapLoginCurrentComputer
SoftwareInstanceStopped
SoftwareInstanceDestroyed
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListDelivered
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
CheckComputerPartitionIsFree
CheckComputerPartitionNoInstanceHostingSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_bug_destruction_with_cancelled_packing_list(self):
"""Proves that even if some packing lists are in cancelled state
it is possible to destroy software instance"""
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string + """
# Request destruction...
LoginDefaultUser
RequestSoftwareInstanceDestroy
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
# and cancel current destruction.
LoginDefaultUser
SelectCurrentlyUsedSalePackingListUid
CancelSalePackingList
Tic
CheckComputerPartitionInstanceCleanupSalePackingListCancelled
Logout
# So all packing lists are finished, but one is cancelled,
# time to request destruction...
LoginDefaultUser
RequestSoftwareInstanceDestroy
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
# ...and destroy it
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
CheckComputerPartitionIsFree
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_bug_destruction_with_unfinished_packing_list(self):
"""Proves that even if some packing lists are not fully delivered
it is possible to destroy software instance"""
......@@ -9568,7 +9670,20 @@ class TestVifibSlapWebService(testVifibMixin):
DirectRequestComputerPartitionRaisesCyclicSoftwareTree
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
import erp5.document.SoftwareInstance
def makeTrue(*args, **kwargs):
return True
# Disable temporialy checkConnected in order to have only
# checkCyclic called
erp5.document.SoftwareInstance.original_checkConnected = \
erp5.document.SoftwareInstance.checkConnected
erp5.document.SoftwareInstance.checkConnected = makeTrue
try:
sequence_list.play(self)
finally:
erp5.document.SoftwareInstance.checkConnected = \
erp5.document.SoftwareInstance.original_checkConnected
del(erp5.document.SoftwareInstance.original_checkConnected)
def stepDirectRequestComputerPartitionRaisesValueError(self,
sequence, **kw):
......
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