Commit 4f45c0df authored by Łukasz Nowak's avatar Łukasz Nowak

Implement bang method.

Implementeded parts:

 * client side slap.ComputerPartition.bang
 * server side reportComputerPartitionBang

This method triggers update of whole instance tree by using
requestUpdateComputerPartition.

Squashed commit of the following:

commit afaaaf6e76de96b70b9b1d3625cbc408024c280e
Merge: 6e3ed1e c2a1455e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Oct 4 10:18:58 2011 +0200

    Merge branch 'master' into bang

    Conflicts:
    	master/bt5/vifib_base/bt/revision
    	master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py

commit 6e3ed1ef90d4916b6d3bdfb29a97f78c950feb4b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Oct 4 10:11:06 2011 +0200

    Check that message sent by bang is correctly stored.

commit 0774d6f5ed21ae47f44d4d405095247532df45b3
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Oct 4 09:59:41 2011 +0200

    Prove that bang in any part of tree updates the whole tree.

commit 2d9b44971d35ba33af6671c94d3ed1778d80beb4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Oct 4 09:34:45 2011 +0200

    Fix finding root.

commit b3c42077c076a7edae8dc7824283fa45e973e717
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 18:14:23 2011 +0200

    Initialise bang testing.

commit 95d16bc41050a35325065c08927a24b9b1beda6e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 16:35:30 2011 +0200

    Implement bang on the whole software instance tree.

commit 6f251837c8e6265209b06600f177267b8239f71f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 16:16:42 2011 +0200

    Pick the newest buildout.

commit df5ae80624b9788030c93e7cd01482f20926f443
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 15:56:37 2011 +0200

    Implement server side softwareInstanceBang support.

commit 8145f0bc1b5d7d92b234a4e5204924a9bf5f5089
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 15:54:17 2011 +0200

    Implement ComputerPartition.bang

commit 949488534c541d1c960b5e1a8f82de5067aaf706
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 14:47:49 2011 +0200

    Cover person begin requesting.

commit 09fb07bcae69e806c82953762cf95c7762f62973
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 14:26:23 2011 +0200

    Prove that no update packing list is created when request is in progress.

commit 93dfc1fc1015da6ee53cd2aa061e994994f6a8a5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 11:29:03 2011 +0200

    Rewrite test in order to follow logic.

    It raises before, but leave required checks.

commit 328666079187437bf23d259abf7e2e132fefe5ae
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 11:04:16 2011 +0200

    Prove that during destruction in progress no update is created.

    Again: such operation will result in update software instance.

commit 5b7a0abe18e325d16eb228794eb8546c236bf49f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:58:02 2011 +0200

    Prove that during start in progress no update is done.

commit 420c66b7f3d9ff3bde7a483d3a72107fe591f754
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:54:25 2011 +0200

    Do not interfere with start or destruction in progress.

    Those actions will result in instance update, no need to create any.

commit e7e7c1a40cb57dafb4d0044d39ba6eae00716e81
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:32:54 2011 +0200

    One another place to avoid update creation.

    Add notes about impossibly to fetch correct tag.

commit 41bc0f1b92d5b836635b6c43ba98d9c5b6095d4d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:28:46 2011 +0200

    Another lock test to avoid update during request.

commit 3c9d408c8ac6381e6a8706543dfa85857eef43bd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 09:45:11 2011 +0200

    Revert "Avoid resetting test CA."

    This reverts commit a3e246e8156d4b016723aaa13ddc116f0dad14e2.

    Conflicts:

    	master/product/Vifib/tests/VifibMixin.py

commit 70a6f27faf44bdeeeb6930516b4b45b53cedab96
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 09:41:00 2011 +0200

    Revert "For safety make small gap."

    This reverts commit 925c10370d7cf002188500f704d3ae882ba7aeb1.

commit 8a510bcfa1d24fe005e3383e7dec093e672e303d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 17:23:47 2011 +0200

    No, setup in delivered is NOT supported.

commit 925c10370d7cf002188500f704d3ae882ba7aeb1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 17:21:33 2011 +0200

    For safety make small gap.

commit 4efecddd41251928f8f0116dfd2dc8f804978b44
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:41:05 2011 +0200

    Cover ignored cases.

commit 58d502c49633468e8c8df66660cb870e5f06d1f1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:32:47 2011 +0200

    OpenSSL serials are in base 16.

commit aec5e64ad158f5eec0c61bb2cfb22450b3841486
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:27:11 2011 +0200

    Check started and special stopped state.

    Started is usual state.

    When instance was requested in stopped state, instace update shall support case
    of instance setup packing list.

commit 8ab1ffe4f5beb8047523461dd4072f7db63a97f7
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:25:41 2011 +0200

    Support case of request SI with stopped state.

    In such case there is only Instance Setup Packing List which if in stopped
    state allows to deliver inset update PPL.

commit 43568cd2017cfbc4ed4676f075535394caf77352
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:47:42 2011 +0200

    Proof that update works on stopped software instance.

commit 8a855c01f1cdcfa70b819609ff423ed574ed949b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:25:40 2011 +0200

    Typo.

commit 30dc522284e5ff23681966c44b6d73c5eac5ed15
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:22:34 2011 +0200

    It is better to reset test environment instead of CA.

commit 85accd973f72e98cc33356644701fe910adbea0a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:07:36 2011 +0200

    Define tests.

commit 9621885fd1be692b7d5387c59f0f596257ec89e7
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:34:04 2011 +0200

    Drop local_permission_vifib_interaction_workflow

    It is defined and configured in vifib_erp5.

commit 6279404c4bd48c933c6a0e17e2e258affdc6d2b9
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:17:40 2011 +0200

    Do not set slap_interaction_workflow in vifib_base.

    This workflow is available in vifib_slap, and those types are configured in
    former business template.

commit 9bf84264777283f5c876d45d4b6b74a3fdc1ba3e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:10:48 2011 +0200

    Skeleton for update packing list tests.

commit 8dfacef65bc5f4e7c940164a30f746db1e7b0534
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:08:32 2011 +0200

    Avoid plurals.

commit 784511374d47a89255b29d0fe69fa41e66d856e4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:06:25 2011 +0200

    Cleanup imports.

    It lowers pyflakes complaints and allows to have minimalist required test module.

commit 8b7bc851d1724f40f2b843636d9f5a5f080ae15f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 13:55:32 2011 +0200

    Separate bug related tests.

commit d775aa6f6f95e40753c31235fe13f607312c613a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 13:50:12 2011 +0200

    Keep "compatibility"

    If not update packing list was defined in active state fallback to previous
    "failing" behaviour.

    It is not defined what shall happen in cases when not correct
    (eg: stopped->stopped) is requested, and new functionality shall not impact it.

commit ff88c3704cde5aa8da0fee65ddbe8105a0bbe64b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:39:57 2011 +0200

    Process update packing list on started and stopped responses.

commit 2a833c884e558860dbeef3989adae95edbe6ff29
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:39:09 2011 +0200

    Provide update packing list delivery script.

    If there update packing list was found and it was in correct state, this scripts
    returns True, to indicate that update packing list was managed.

commit 4b9923f10730ad95816f70fff20c96531ef0d741
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:38:35 2011 +0200

    Allow to pass own state_list.

commit e34819d6d4892248cf4ca550e1d5fb710a1fe14f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:37:36 2011 +0200

    Support update packing list.

    It impacts presence of partition on list.

commit b95b568c7a90f71566bbf072058b2a623d736abf
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:25:26 2011 +0200

    Support update resource.

commit aecca5f228f7607c7037d28c14ac852885c352f5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:43:26 2011 +0200

    Destroy is "unsupported" too.

commit 96fc577fff652a0311d1d1c4bc7def491fd8dd7e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:42:25 2011 +0200

    Create update packing list.

    Create only when Instance Hosting or Setup are in correct states.

commit 2a95ee39a9d81ba7a2ade496556844e867d634d3
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:42:13 2011 +0200

    Support None tag.

commit e56bc4390a084d1d3162c1c0c2c3c8b75b012e6d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:44:56 2011 +0200

    Call proper script.

commit a3e246e8156d4b016723aaa13ddc116f0dad14e2
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:20:45 2011 +0200

    Avoid resetting test CA.

    It allows to live coexist test instance and development site on same instance.

commit dacd5ab8a2e1d77ef88051e8e6d9aa82d1e0342c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:17:19 2011 +0200

    Make it pass consistency check.

commit 83f08e4ff8c3a1c066df8a2e0aca027abe7916b2
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:10:55 2011 +0200

    Add vifib_instance_update to data.

commit 2a5ef6f082a9ff2c2d05208a67419fab7bfdbd69
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:06:56 2011 +0200

    Add preferred_instance_update_resource_property with UI.

commit 420eaddf73f8ca41cc2089325372d14d870a533c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:57:46 2011 +0200

    Export from ERP5.

    Seems like file was edited locally.

commit fd4377bca8a79ff25908c19b8b929396a49b8a13
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:57:20 2011 +0200

    Add missing BT5 metadata.

commit ce7d695587c81aa53a9f5c5680233b34183c22bb
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:49:56 2011 +0200

    Partially revert mistake in 324c9104

    Person document class was removed.

commit 206ec5c30e59ecfb62ea58eee9f6f4c35dc24aa4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:46:38 2011 +0200

    Add request_update_computer_partition.

    Also remove update_slave_partition_list, which seems like wrongly commited BT5.
parent c2a1455e
...@@ -51,4 +51,4 @@ eggs = ...@@ -51,4 +51,4 @@ eggs =
slapos.core slapos.core
[versions] [versions]
zc.buildout = 1.5.3-dev-SlapOS-008 zc.buildout = 1.5.3-dev-SlapOS-010
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n
portal = context.getPortalObject()\n
\n
root_software_instance = software_instance\n
while (software_instance is not None):\n
root_software_instance = software_instance\n
software_instance = software_instance.getPredecessorRelatedValue()\n
\n
for software_instance in context.portal_catalog(\n
portal_type=\'Software Instance\',\n
root_uid=root_software_instance.getUid()):\n
software_instance = software_instance.getObject()\n
# shall it be done in activities?\n
#software_instance.activate().requestUpdateComputerPartition()\n
software_instance.requestUpdateComputerPartition()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_bangSoftwareInstanceTree</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string> <string>destroy_requested</string>
<string>report_computer_partition_bang</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>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string> <string>destroy_requested</string>
<string>report_computer_partition_bang</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>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string> <string>destroy_requested</string>
<string>report_computer_partition_bang</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>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
<tuple> <tuple>
<string>destroy_computer_partition</string> <string>destroy_computer_partition</string>
<string>destroy_requested</string> <string>destroy_requested</string>
<string>report_computer_partition_bang</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>SoftwareInstance_bangSoftwareInstanceTree</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>report_computer_partition_bang</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></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>
296 299
\ No newline at end of file \ No newline at end of file
...@@ -235,6 +235,16 @@ class SlapTool(BaseTool): ...@@ -235,6 +235,16 @@ class SlapTool(BaseTool):
return self._softwareInstanceError(computer_id, computer_partition_id, return self._softwareInstanceError(computer_id, computer_partition_id,
error_log) error_log)
security.declareProtected(Permissions.AccessContentsInformation,
'softwareInstanceBang')
def softwareInstanceBang(self, computer_id,
computer_partition_id, message):
"""
Fire up bang on this Software Instance
"""
return self._softwareInstanceBang(computer_id, computer_partition_id,
message)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'startedComputerPartition') 'startedComputerPartition')
def startedComputerPartition(self, computer_id, computer_partition_id): def startedComputerPartition(self, computer_id, computer_partition_id):
...@@ -577,6 +587,18 @@ class SlapTool(BaseTool): ...@@ -577,6 +587,18 @@ class SlapTool(BaseTool):
computer_partition_id).reportComputerPartitionError( computer_partition_id).reportComputerPartitionError(
comment=error_log) comment=error_log)
@convertToREST
def _softwareInstanceBang(self, computer_id,
computer_partition_id, message):
"""
Fire up bang on Software Instance
Add an error for the software Instance Workflow
"""
return self._getSoftwareInstanceForComputerPartition(
computer_id,
computer_partition_id).reportComputerPartitionBang(
comment=message)
@convertToREST @convertToREST
def _startedComputerPartition(self, computer_id, computer_partition_id): def _startedComputerPartition(self, computer_id, computer_partition_id):
""" """
......
from Products.ERP5Type.tests.Sequence import SequenceList
import unittest
from slapos import slap
from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from random import random
class TestVifibSlapComputerPartitionBang(TestVifibSlapWebServiceMixin):
bang_message = 'Bang message'
# expected scenarios
def stepFinishSoftwareInstanceTree(self, sequence, **kw):
rand = str(random())
S1 = 'S1' + rand
S2 = 'S2' + rand
S3 = 'S3' + rand
S4 = 'S4' + rand
root_software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
common_kw = dict(
software_release=sequence['software_release_uri'],
software_type='any', instance_xml=self.minimal_correct_xml,
sla_xml=self.minimal_correct_xml, state='stopped')
root_software_instance.requestSoftwareInstance(partition_reference=S1,
**common_kw)
self.stepTic()
S1_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S1)
S1_instance.requestSoftwareInstance(partition_reference=S2, **common_kw)
self.stepTic()
S1_instance.requestSoftwareInstance(partition_reference=S3, **common_kw)
self.stepTic()
root_software_instance.requestSoftwareInstance(partition_reference=S4,
**common_kw)
self.stepTic()
S2_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S2)
S3_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S3)
S4_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S4)
S1_instance.stopComputerPartitionInstallation()
S2_instance.stopComputerPartitionInstallation()
S3_instance.stopComputerPartitionInstallation()
S4_instance.stopComputerPartitionInstallation()
self.stepTic()
sequence.edit(
S0_uid = sequence['software_instance_uid'],
S1_uid = S1_instance.getUid(),
S2_uid = S2_instance.getUid(),
S3_uid = S3_instance.getUid(),
S4_uid = S4_instance.getUid()
)
def stepBang(self, sequence, **kw):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url)
slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'],
sequence['computer_partition_reference'])
slap_computer_partition.bang(self.bang_message)
def stepProcessSoftwareInstanceList(self, sequence, **kw):
S0 = self.portal.portal_catalog.getResultValue(uid=sequence['S0_uid'])
S0.startComputerPartition()
S1 = self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid'])
S1.stopComputerPartition()
S2 = self.portal.portal_catalog.getResultValue(uid=sequence['S2_uid'])
S2.stopComputerPartition()
S3 = self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid'])
S3.stopComputerPartition()
S4 = self.portal.portal_catalog.getResultValue(uid=sequence['S4_uid'])
S4.stopComputerPartition()
def stepSetCurrentSoftwareInstanceS1(self, sequence, **kw):
S1 = self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid'])
sequence.edit(
software_instance_reference=S1.getReference(),
computer_partition_reference=S1.getAggregateRelatedValue()\
.getAggregateValue(portal_type='Computer Partition').getReference()
)
def stepSetCurrentSoftwareInstanceS3(self, sequence, **kw):
S3 = self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid'])
sequence.edit(
software_instance_reference=S3.getReference(),
computer_partition_reference=S3.getAggregateRelatedValue()\
.getAggregateValue(portal_type='Computer Partition').getReference()
)
def checkSoftwareInstanceBangMessage(self, software_instance):
bang_list = [q for q in software_instance.Base_getWorkflowHistoryItemList(
'software_instance_slap_interface_workflow')
if q.action == 'report_computer_partition_bang']
self.assertEqual(1, len(bang_list))
self.assertEqual(self.bang_message, bang_list[0].comment)
def stepStepCheckS0BangMessage(self, sequence, **kw):
self.checkSoftwareInstanceBangMessage(
self.portal.portal_catalog.getResultValue(uid=sequence['S0_uid']))
def stepStepCheckS1BangMessage(self, sequence, **kw):
self.checkSoftwareInstanceBangMessage(
self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid']))
def stepStepCheckS3BangMessage(self, sequence, **kw):
self.checkSoftwareInstanceBangMessage(
self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid']))
def test_bang_complex_tree(self):
"""Checks that bangs works on complex tree
For tree like:
S0
/ \
S4 S1
/ \
S2 S3
Invoking bang on Root, S1 or S3 will made whole tree updatable.
"""
self.computer_partition_amount = 5
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string + \
"""
LoginDefaultUser
FinishSoftwareInstanceTree
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentSoftwareInstance
Bang
Tic
SlapLogout
LoginDefaultUser
StepCheckS0BangMessage
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
LoginDefaultUser
ProcessSoftwareInstanceList
Tic
SetCurrentSoftwareInstanceS1
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentSoftwareInstance
Bang
Tic
SlapLogout
LoginDefaultUser
StepCheckS1BangMessage
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
LoginDefaultUser
ProcessSoftwareInstanceList
Tic
SetCurrentSoftwareInstanceS3
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentSoftwareInstance
Bang
Tic
SlapLogout
LoginDefaultUser
StepCheckS3BangMessage
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionBang))
return suite
...@@ -392,6 +392,13 @@ class ComputerPartition(SlapDocument): ...@@ -392,6 +392,13 @@ class ComputerPartition(SlapDocument):
'computer_partition_id': self._partition_id, 'computer_partition_id': self._partition_id,
'error_log': error_log}) 'error_log': error_log})
@_requestIfNeeded
def bang(self, message):
self._connection_helper.POST('/softwareInstanceBang', {
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
'message': message})
@_requestIfNeeded @_requestIfNeeded
def getId(self): def getId(self):
return self._partition_id return self._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