Commit cb45f4f2 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5&cloud&accounting: Fix up Naminig convention

parent 5978f1fc
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</item> </item>
<item> <item>
<key> <string>delivery_after_generation_script_id</string> </key> <key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>SlapOSSaleInvoiceTransaction_postGeneration</string> </value> <value> <string>SaleInvoiceTransaction_postSlapOSGeneration</string> </value>
</item> </item>
<item> <item>
<key> <string>delivery_cell_collect_order</string> </key> <key> <string>delivery_cell_collect_order</string> </key>
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_select_method_id</string> </key> <key> <string>simulation_select_method_id</string> </key>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value> <value> <string>DeliveryBuilder_selectSlapOSMovement</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
</item> </item>
<item> <item>
<key> <string>delivery_select_method_id</string> </key> <key> <string>delivery_select_method_id</string> </key>
<value> <string>SlapOSInvoiceTransaction_selectDelivery</string> </value> <value> <string>SaleInvoiceTransaction_selectSlapOSDelivery</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_select_method_id</string> </key> <key> <string>simulation_select_method_id</string> </key>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value> <value> <string>DeliveryBuilder_selectSlapOSMovement</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
</item> </item>
<item> <item>
<key> <string>delivery_select_method_id</string> </key> <key> <string>delivery_select_method_id</string> </key>
<value> <string>SlapOSInvoiceTransaction_selectDelivery</string> </value> <value> <string>SaleInvoiceTransaction_selectSlapOSDelivery</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_select_method_id</string> </key> <key> <string>simulation_select_method_id</string> </key>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value> <value> <string>DeliveryBuilder_selectSlapOSMovement</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
</item> </item>
<item> <item>
<key> <string>delivery_after_generation_script_id</string> </key> <key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>SlapOSSalePackingList_postGeneration</string> </value> <value> <string>SalePackingList_postSlapOSGeneration</string> </value>
</item> </item>
<item> <item>
<key> <string>delivery_cell_collect_order</string> </key> <key> <string>delivery_cell_collect_order</string> </key>
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
</item> </item>
<item> <item>
<key> <string>simulation_select_method_id</string> </key> <key> <string>simulation_select_method_id</string> </key>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value> <value> <string>DeliveryBuilder_selectSlapOSMovement</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -6,5 +6,5 @@ portal = context.getPortalObject() ...@@ -6,5 +6,5 @@ portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type="Software Release", portal_type="Software Release",
method_id="SotftwareRelease_updateCapacityQuantity", method_id="SoftwareRelease_updateCapacityQuantity",
) )
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>HostingSubscript_getEcoReallocationInformation</string> </value> <value> <string>HostingSubscription_getEcoReallocationInformation</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_tryToGarbageCollect</string> </value> <value> <string>SoftwareRelease_updateCapacityQuantity</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -324,7 +324,7 @@ ...@@ -324,7 +324,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSDeliveryBuilder_selectMovement</string> </value> <value> <string>DeliveryBuilder_selectSlapOSMovement</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSPaymentTransaction_postGeneration</string> </value> <value> <string>PaymentTransaction_postSlapOSGeneration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSSaleInvoiceTransaction_postGeneration</string> </value> <value> <string>SaleInvoiceTransaction_postSlapOSGeneration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSInvoiceTransaction_selectDelivery</string> </value> <value> <string>SaleInvoiceTransaction_selectSlapOSDelivery</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SlapOSSalePackingList_postGeneration</string> </value> <value> <string>SalePackingList_postSlapOSGeneration</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -4,7 +4,7 @@ portal.portal_catalog.searchAndActivate( ...@@ -4,7 +4,7 @@ portal.portal_catalog.searchAndActivate(
portal_type=["Slave Instance", "Software Instance"], portal_type=["Slave Instance", "Software Instance"],
validation_state="validated", validation_state="validated",
specialise_validation_state="archived", specialise_validation_state="archived",
method_id='Instance_tryToGarbageCollect', method_id='SoftwareInstance_tryToGarbageCollect',
activate_kw={'tag': tag}, activate_kw={'tag': tag},
**{"slapos_item.slap_state": ("start_requested", "stop_requested")} **{"slapos_item.slap_state": ("start_requested", "stop_requested")}
) )
......
...@@ -7,7 +7,7 @@ portal.portal_catalog.searchAndActivate( ...@@ -7,7 +7,7 @@ portal.portal_catalog.searchAndActivate(
select_dict=select_dict, select_dict=select_dict,
left_join_list=select_dict.keys(), left_join_list=select_dict.keys(),
method_id='Instance_tryToGarbageCollectNonAllocatedRootTree', method_id='SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree',
activate_kw={'tag': tag}, activate_kw={'tag': tag},
**{"slapos_item.slap_state": ['start_requested', 'stop_requested']} **{"slapos_item.slap_state": ['start_requested', 'stop_requested']}
) )
......
...@@ -4,7 +4,7 @@ portal.portal_catalog.searchAndActivate( ...@@ -4,7 +4,7 @@ portal.portal_catalog.searchAndActivate(
portal_type=["Software Instance", "Slave Instance"], portal_type=["Software Instance", "Slave Instance"],
default_aggregate_relative_url="computer_module/%/%", default_aggregate_relative_url="computer_module/%/%",
validation_state="invalidated", validation_state="invalidated",
method_id='Instance_tryToUnallocatePartition', method_id='SoftwareInstance_tryToUnallocatePartition',
activate_kw={'tag': tag} activate_kw={'tag': tag}
) )
......
...@@ -8,7 +8,7 @@ portal.portal_catalog.searchAndActivate( ...@@ -8,7 +8,7 @@ portal.portal_catalog.searchAndActivate(
portal_type=["Slave Instance", "Software Instance"], portal_type=["Slave Instance", "Software Instance"],
validation_state="validated", validation_state="validated",
specialise_validation_state="validated", specialise_validation_state="validated",
method_id='Instance_tryToStopCollect', method_id='SoftwareInstance_tryToStopCollect',
activate_kw={'tag': tag}, activate_kw={'tag': tag},
**{"slapos_item.slap_state": "start_requested"} **{"slapos_item.slap_state": "start_requested"}
) )
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_tryToUnallocatePartition</string> </value> <value> <string>SoftwareInstance_tryToGarbageCollect</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_tryToGarbageCollectNonAllocatedRootTree</string> </value> <value> <string>SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_tryToStopCollect</string> </value> <value> <string>SoftwareInstance_tryToStopCollect</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SotftwareRelease_updateCapacityQuantity</string> </value> <value> <string>SoftwareInstance_tryToUnallocatePartition</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -117,7 +117,7 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin): ...@@ -117,7 +117,7 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree() self._makeTree()
def test_Instance_tryToUnallocatePartition(self): def test_SoftwareInstance_tryToUnallocatePartition(self):
self._makeComputer() self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.partition.markBusy() self.partition.markBusy()
...@@ -125,12 +125,12 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin): ...@@ -125,12 +125,12 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.software_instance.Instance_tryToUnallocatePartition() self.software_instance.SoftwareInstance_tryToUnallocatePartition()
self.tic() self.tic()
self.assertEqual(None, self.software_instance.getAggregate()) self.assertEqual(None, self.software_instance.getAggregate())
self.assertEqual('free', self.partition.getSlapState()) self.assertEqual('free', self.partition.getSlapState())
def test_Instance_tryToUnallocatePartition_concurrency(self): def test_SoftwareInstance_tryToUnallocatePartition_concurrency(self):
self._makeComputer() self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.partition.markBusy() self.partition.markBusy()
...@@ -141,13 +141,13 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin): ...@@ -141,13 +141,13 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin):
self.partition.activate(tag="allocate_%s" % self.partition.getRelativeUrl()\ self.partition.activate(tag="allocate_%s" % self.partition.getRelativeUrl()\
).getId() ).getId()
transaction.commit() transaction.commit()
self.software_instance.Instance_tryToUnallocatePartition() self.software_instance.SoftwareInstance_tryToUnallocatePartition()
self.tic() self.tic()
self.assertEqual(self.partition.getRelativeUrl(), self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate()) self.software_instance.getAggregate())
self.assertEqual('busy', self.partition.getSlapState()) self.assertEqual('busy', self.partition.getSlapState())
def test_Instance_tryToUnallocatePartition_twoInstances(self): def test_SoftwareInstance_tryToUnallocatePartition_twoInstances(self):
software_instance = self.portal.software_instance_module\ software_instance = self.portal.software_instance_module\
.template_software_instance.Base_createCloneDocument(batch_mode=1) .template_software_instance.Base_createCloneDocument(batch_mode=1)
...@@ -159,30 +159,12 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin): ...@@ -159,30 +159,12 @@ class TestSlapOSFreeComputerPartitionAlarm(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.software_instance.Instance_tryToUnallocatePartition() self.software_instance.SoftwareInstance_tryToUnallocatePartition()
self.tic() self.tic()
self.assertEqual(None, self.software_instance.getAggregate()) self.assertEqual(None, self.software_instance.getAggregate())
self.assertEqual('busy', self.partition.getSlapState()) self.assertEqual('busy', self.partition.getSlapState())
self.assertEqual(self.partition.getRelativeUrl(), software_instance.getAggregate()) self.assertEqual(self.partition.getRelativeUrl(), software_instance.getAggregate())
def _simulateInstance_tryToUnallocatePartition(self):
script_name = 'Instance_tryToUnallocatePartition'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kwargs',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Instance_tryToUnallocatePartition') """ )
transaction.commit()
def _dropInstance_tryToUnallocatePartition(self):
script_name = 'Instance_tryToUnallocatePartition'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_alarm_allocated(self): def test_alarm_allocated(self):
self._makeComputer() self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
...@@ -191,14 +173,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -191,14 +173,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
'destroy_requested') 'destroy_requested')
self.software_instance.invalidate() self.software_instance.invalidate()
self.tic() self.tic()
self._simulateInstance_tryToUnallocatePartition() self._simulateScript('SoftwareInstance_tryToUnallocatePartition')
try: try:
self.portal.portal_alarms.slapos_free_computer_partition.activeSense() self.portal.portal_alarms.slapos_free_computer_partition.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToUnallocatePartition() self._dropScript('SoftwareInstance_tryToUnallocatePartition')
self.assertEqual( self.assertEqual(
'Visited by Instance_tryToUnallocatePartition', 'Visited by SoftwareInstance_tryToUnallocatePartition',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_unallocated(self): def test_alarm_unallocated(self):
...@@ -208,14 +190,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -208,14 +190,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
'destroy_requested') 'destroy_requested')
self.software_instance.invalidate() self.software_instance.invalidate()
self.tic() self.tic()
self._simulateInstance_tryToUnallocatePartition() self._simulateScript('SoftwareInstance_tryToUnallocatePartition')
try: try:
self.portal.portal_alarms.slapos_free_computer_partition.activeSense() self.portal.portal_alarms.slapos_free_computer_partition.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToUnallocatePartition() self._dropScript('SoftwareInstance_tryToUnallocatePartition')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToUnallocatePartition', 'Visited by SoftwareInstance_tryToUnallocatePartition',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_validated(self): def test_alarm_validated(self):
...@@ -225,14 +207,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -225,14 +207,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self._simulateInstance_tryToUnallocatePartition() self._simulateScript('SoftwareInstance_tryToUnallocatePartition')
try: try:
self.portal.portal_alarms.slapos_free_computer_partition.activeSense() self.portal.portal_alarms.slapos_free_computer_partition.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToUnallocatePartition() self._dropScript('SoftwareInstance_tryToUnallocatePartition')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToUnallocatePartition', 'Visited by SoftwareInstance_tryToUnallocatePartition',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_start_requested(self): def test_alarm_start_requested(self):
...@@ -240,14 +222,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -240,14 +222,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.partition.markBusy() self.partition.markBusy()
self.tic() self.tic()
self._simulateInstance_tryToUnallocatePartition() self._simulateScript('SoftwareInstance_tryToUnallocatePartition')
try: try:
self.portal.portal_alarms.slapos_free_computer_partition.activeSense() self.portal.portal_alarms.slapos_free_computer_partition.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToUnallocatePartition() self._dropScript('SoftwareInstance_tryToUnallocatePartition')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToUnallocatePartition', 'Visited by SoftwareInstance_tryToUnallocatePartition',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin): class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin):
...@@ -255,7 +237,7 @@ class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin): ...@@ -255,7 +237,7 @@ class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree(requested_template_id='template_slave_instance') self._makeTree(requested_template_id='template_slave_instance')
def test_Instance_tryToUnallocatePartition(self): def test_SoftwareInstance_tryToUnallocatePartition(self):
self._makeComputer() self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.partition.markBusy() self.partition.markBusy()
...@@ -263,18 +245,18 @@ class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin): ...@@ -263,18 +245,18 @@ class TestSlapOSFreeComputerPartitionAlarmWithSlave(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.software_instance.Instance_tryToUnallocatePartition() self.software_instance.SoftwareInstance_tryToUnallocatePartition()
self.tic() self.tic()
self.assertEqual(None, self.software_instance.getAggregate()) self.assertEqual(None, self.software_instance.getAggregate())
self.assertEqual('free', self.partition.getSlapState()) self.assertEqual('free', self.partition.getSlapState())
def test_Instance_tryToUnallocatePartition_nonDestroyed(self): def test_SoftwareInstance_tryToUnallocatePartition_nonDestroyed(self):
self._makeComputer() self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl()) self.software_instance.setAggregate(self.partition.getRelativeUrl())
self.partition.markBusy() self.partition.markBusy()
self.tic() self.tic()
self.software_instance.Instance_tryToUnallocatePartition() self.software_instance.SoftwareInstance_tryToUnallocatePartition()
self.tic() self.tic()
self.assertEqual(self.partition.getRelativeUrl(), self.assertEqual(self.partition.getRelativeUrl(),
self.software_instance.getAggregate()) self.software_instance.getAggregate())
...@@ -287,7 +269,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -287,7 +269,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
SlapOSTestCaseMixin.afterSetUp(self) SlapOSTestCaseMixin.afterSetUp(self)
self._makeTree() self._makeTree()
def test_Instance_tryToGarbageCollect(self): def test_SoftwareInstance_tryToGarbageCollect(self):
self.hosting_subscription.archive() self.hosting_subscription.archive()
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
...@@ -295,48 +277,48 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -295,48 +277,48 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('destroy_requested', self.assertEqual('destroy_requested',
self.requested_software_instance.getSlapState()) self.requested_software_instance.getSlapState())
self.assertEqual('validated', self.assertEqual('validated',
self.requested_software_instance.getValidationState()) self.requested_software_instance.getValidationState())
def test_Instance_tryToGarbageCollect_not_destroy_requested(self): def test_SoftwareInstance_tryToGarbageCollect_not_destroy_requested(self):
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('start_requested', self.assertEqual('start_requested',
self.requested_software_instance.getSlapState()) self.requested_software_instance.getSlapState())
self.assertEqual('validated', self.assertEqual('validated',
self.requested_software_instance.getValidationState()) self.requested_software_instance.getValidationState())
def test_Instance_tryToGarbageCollect_not_archived(self): def test_SoftwareInstance_tryToGarbageCollect_not_archived(self):
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('start_requested', self.assertEqual('start_requested',
self.requested_software_instance.getSlapState()) self.requested_software_instance.getSlapState())
self.assertEqual('validated', self.assertEqual('validated',
self.requested_software_instance.getValidationState()) self.requested_software_instance.getValidationState())
def test_Instance_tryToGarbageCollect_only_instance_destroy_requested(self): def test_SoftwareInstance_tryToGarbageCollect_only_instance_destroy_requested(self):
self.portal.portal_workflow._jumpToStateFor(self.software_instance, self.portal.portal_workflow._jumpToStateFor(self.software_instance,
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('start_requested', self.assertEqual('start_requested',
self.requested_software_instance.getSlapState()) self.requested_software_instance.getSlapState())
self.assertEqual('validated', self.assertEqual('validated',
self.requested_software_instance.getValidationState()) self.requested_software_instance.getValidationState())
def test_Instance_tryToGarbageCollect_unlinked_predecessor(self): def test_SoftwareInstance_tryToGarbageCollect_unlinked_predecessor(self):
self.requested_software_instance.edit(predecessor_list=[]) self.requested_software_instance.edit(predecessor_list=[])
self.hosting_subscription.archive() self.hosting_subscription.archive()
self.portal.portal_workflow._jumpToStateFor(self.hosting_subscription, self.portal.portal_workflow._jumpToStateFor(self.hosting_subscription,
...@@ -345,7 +327,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -345,7 +327,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('destroy_requested', self.assertEqual('destroy_requested',
...@@ -353,7 +335,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -353,7 +335,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
self.assertEqual('validated', self.assertEqual('validated',
self.requested_software_instance.getValidationState()) self.requested_software_instance.getValidationState())
def test_Instance_tryToGarbageCollect_destroy_unlinked_with_child(self): def test_SoftwareInstance_tryToGarbageCollect_destroy_unlinked_with_child(self):
instance_kw = dict(software_release=self.generateNewSoftwareReleaseUrl(), instance_kw = dict(software_release=self.generateNewSoftwareReleaseUrl(),
software_type=self.generateNewSoftwareType(), software_type=self.generateNewSoftwareType(),
instance_xml=self.generateSafeXml(), instance_xml=self.generateSafeXml(),
...@@ -374,7 +356,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -374,7 +356,7 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
'destroy_requested') 'destroy_requested')
self.tic() self.tic()
self.requested_software_instance.Instance_tryToGarbageCollect() self.requested_software_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual('destroy_requested', self.assertEqual('destroy_requested',
...@@ -386,14 +368,14 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -386,14 +368,14 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
None) None)
self.assertEqual(sub_instance.getSlapState(), 'start_requested') self.assertEqual(sub_instance.getSlapState(), 'start_requested')
sub_instance.Instance_tryToGarbageCollect() sub_instance.SoftwareInstance_tryToGarbageCollect()
self.tic() self.tic()
self.assertEqual(sub_instance.getSlapState(), 'destroy_requested') self.assertEqual(sub_instance.getSlapState(), 'destroy_requested')
self.assertEqual(sub_instance.getValidationState(), 'validated') self.assertEqual(sub_instance.getValidationState(), 'validated')
def _simulateInstance_tryToGarbageCollect(self): def _simulateSoftwareInstance_tryToGarbageCollect(self):
script_name = 'Instance_tryToGarbageCollect' script_name = 'SoftwareInstance_tryToGarbageCollect'
if script_name in self.portal.portal_skins.custom.objectIds(): if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name) raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom, createZODBPythonScript(self.portal.portal_skins.custom,
...@@ -401,11 +383,11 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -401,11 +383,11 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(SlapOSTestCaseMixin):
'*args, **kwargs', '*args, **kwargs',
'# Script body\n' '# Script body\n'
"""portal_workflow = context.portal_workflow """portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Instance_tryToGarbageCollect') """ ) portal_workflow.doActionFor(context, action='edit_action', comment='Visited by SoftwareInstance_tryToGarbageCollect') """ )
transaction.commit() transaction.commit()
def _dropInstance_tryToGarbageCollect(self): def _dropSoftwareInstance_tryToGarbageCollect(self):
script_name = 'Instance_tryToGarbageCollect' script_name = 'SoftwareInstance_tryToGarbageCollect'
if script_name in self.portal.portal_skins.custom.objectIds(): if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name) self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit() transaction.commit()
...@@ -413,40 +395,40 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -413,40 +395,40 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
def test_alarm(self): def test_alarm(self):
self.hosting_subscription.archive() self.hosting_subscription.archive()
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollect() self._simulateScript('SoftwareInstance_tryToGarbageCollect')
try: try:
self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollect() self._dropScript('SoftwareInstance_tryToGarbageCollect')
self.assertEqual( self.assertEqual(
'Visited by Instance_tryToGarbageCollect', 'Visited by SoftwareInstance_tryToGarbageCollect',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_invalidated(self): def test_alarm_invalidated(self):
self.hosting_subscription.archive() self.hosting_subscription.archive()
self.software_instance.invalidate() self.software_instance.invalidate()
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollect() self._simulateScript('SoftwareInstance_tryToGarbageCollect')
try: try:
self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollect() self._dropScript('SoftwareInstance_tryToGarbageCollect')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToGarbageCollect', 'Visited by SoftwareInstance_tryToGarbageCollect',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_not_archived(self): def test_alarm_not_archived(self):
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollect() self._simulateScript('SoftwareInstance_tryToGarbageCollect')
try: try:
self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_destroyed_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollect() self._dropScript('SoftwareInstance_tryToGarbageCollect')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToGarbageCollect', 'Visited by SoftwareInstance_tryToGarbageCollect',
self.software_instance.workflow_history['edit_workflow'][-1]['comment']) self.software_instance.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSUpdateComputerCapacityScopeAlarm(SlapOSTestCaseMixin): class TestSlapOSUpdateComputerCapacityScopeAlarm(SlapOSTestCaseMixin):
...@@ -677,13 +659,13 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -677,13 +659,13 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
self.tic() self.tic()
return instance return instance
def test_Instance_tryToStopCollect_REQUEST_disallowed(self): def test_SoftwareInstance_tryToStopCollect_REQUEST_disallowed(self):
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
self.portal.Instance_tryToStopCollect, self.portal.SoftwareInstance_tryToStopCollect,
REQUEST={}) REQUEST={})
def test_Instance_tryToStopCollect_started_instance(self): def test_SoftwareInstance_tryToStopCollect_started_instance(self):
instance = self.createInstance() instance = self.createInstance()
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
...@@ -691,10 +673,10 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -691,10 +673,10 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
'stop_requested') 'stop_requested')
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
instance.Instance_tryToStopCollect() instance.SoftwareInstance_tryToStopCollect()
self.assertEqual('stop_requested', instance.getSlapState()) self.assertEqual('stop_requested', instance.getSlapState())
def test_Instance_tryToStopCollect_destroyed_instance(self): def test_SoftwareInstance_tryToStopCollect_destroyed_instance(self):
instance = self.createInstance() instance = self.createInstance()
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
...@@ -703,61 +685,43 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -703,61 +685,43 @@ class TestSlapOSGarbageCollectStoppedRootTreeAlarm(SlapOSTestCaseMixin):
self.portal.portal_workflow._jumpToStateFor(instance, self.portal.portal_workflow._jumpToStateFor(instance,
'destroy_requested') 'destroy_requested')
instance.Instance_tryToStopCollect() instance.SoftwareInstance_tryToStopCollect()
self.assertEqual('destroy_requested', instance.getSlapState()) self.assertEqual('destroy_requested', instance.getSlapState())
def test_Instance_tryToStopCollect_started_subscription(self): def test_SoftwareInstance_tryToStopCollect_started_subscription(self):
instance = self.createInstance() instance = self.createInstance()
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
instance.Instance_tryToStopCollect() instance.SoftwareInstance_tryToStopCollect()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
def _simulateInstance_tryToStopCollect(self):
script_name = 'Instance_tryToStopCollect'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kwargs',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Instance_tryToStopCollect') """ )
transaction.commit()
def _dropInstance_tryToStopCollect(self):
script_name = 'Instance_tryToStopCollect'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_alarm(self): def test_alarm(self):
instance = self.createInstance() instance = self.createInstance()
self._simulateInstance_tryToStopCollect() self._simulateScript('SoftwareInstance_tryToStopCollect')
try: try:
self.portal.portal_alarms.slapos_stop_collect_instance.activeSense() self.portal.portal_alarms.slapos_stop_collect_instance.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToStopCollect() self._dropScript('SoftwareInstance_tryToStopCollect')
self.assertEqual( self.assertEqual(
'Visited by Instance_tryToStopCollect', 'Visited by SoftwareInstance_tryToStopCollect',
instance.workflow_history['edit_workflow'][-1]['comment']) instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_invalidated(self): def test_alarm_invalidated(self):
instance = self.createInstance() instance = self.createInstance()
instance.invalidate() instance.invalidate()
self.tic() self.tic()
self._simulateInstance_tryToStopCollect() self._simulateScript('SoftwareInstance_tryToStopCollect')
try: try:
self.portal.portal_alarms.slapos_stop_collect_instance.activeSense() self.portal.portal_alarms.slapos_stop_collect_instance.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToStopCollect() self._dropScript('SoftwareInstance_tryToStopCollect')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToStopCollect', 'Visited by SoftwareInstance_tryToStopCollect',
instance.workflow_history['edit_workflow'][-1]['comment']) instance.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
...@@ -800,7 +764,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -800,7 +764,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
def test_tryToGarbageCollect_REQUEST_disallowed(self): def test_tryToGarbageCollect_REQUEST_disallowed(self):
self.assertRaises( self.assertRaises(
Unauthorized, Unauthorized,
self.portal.Instance_tryToGarbageCollectNonAllocatedRootTree, self.portal.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree,
REQUEST={}) REQUEST={})
def test_tryToGarbageCollect_invalidated_instance(self): def test_tryToGarbageCollect_invalidated_instance(self):
...@@ -808,7 +772,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -808,7 +772,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
instance.invalidate() instance.invalidate()
self.tic() self.tic()
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -818,7 +782,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -818,7 +782,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
self.portal.portal_workflow._jumpToStateFor(instance, 'destroy_requested') self.portal.portal_workflow._jumpToStateFor(instance, 'destroy_requested')
self.tic() self.tic()
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('destroy_requested', instance.getSlapState()) self.assertEqual('destroy_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -829,7 +793,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -829,7 +793,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
instance.edit(aggregate_value=partition) instance.edit(aggregate_value=partition)
self.tic() self.tic()
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -838,7 +802,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -838,7 +802,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
instance = self.createInstance() instance = self.createInstance()
self.tic() self.tic()
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -855,7 +819,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -855,7 +819,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -873,7 +837,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -873,7 +837,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', instance.getSlapState()) self.assertEqual('start_requested', instance.getSlapState())
hosting_subscription = instance.getSpecialiseValue() hosting_subscription = instance.getSpecialiseValue()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
...@@ -903,7 +867,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -903,7 +867,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
sub_instance.Instance_tryToGarbageCollectNonAllocatedRootTree() sub_instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
def test_tryToGarbageCollect_complex_tree_allocation_disallowed(self): def test_tryToGarbageCollect_complex_tree_allocation_disallowed(self):
...@@ -931,7 +895,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -931,7 +895,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
sub_instance.Instance_tryToGarbageCollectNonAllocatedRootTree() sub_instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('start_requested', hosting_subscription.getSlapState()) self.assertEqual('start_requested', hosting_subscription.getSlapState())
def test_tryToGarbageCollect_old_allocation_try_found(self): def test_tryToGarbageCollect_old_allocation_try_found(self):
...@@ -947,7 +911,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -947,7 +911,7 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('destroy_requested', hosting_subscription.getSlapState()) self.assertEqual('destroy_requested', hosting_subscription.getSlapState())
self.assertEqual('archived', hosting_subscription.getValidationState()) self.assertEqual('archived', hosting_subscription.getValidationState())
...@@ -965,53 +929,35 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin): ...@@ -965,53 +929,35 @@ class TestSlapOSGarbageCollectNonAllocatedRootTreeAlarm(SlapOSTestCaseMixin):
'action': 'edit' 'action': 'edit'
}) })
instance.Instance_tryToGarbageCollectNonAllocatedRootTree() instance.SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree()
self.assertEqual('destroy_requested', hosting_subscription.getSlapState()) self.assertEqual('destroy_requested', hosting_subscription.getSlapState())
self.assertEqual('archived', hosting_subscription.getValidationState()) self.assertEqual('archived', hosting_subscription.getValidationState())
def _simulateInstance_tryToGarbageCollectNonAllocatedRootTree(self):
script_name = 'Instance_tryToGarbageCollectNonAllocatedRootTree'
if script_name in self.portal.portal_skins.custom.objectIds():
raise ValueError('Precondition failed: %s exists in custom' % script_name)
createZODBPythonScript(self.portal.portal_skins.custom,
script_name,
'*args, **kwargs',
'# Script body\n'
"""portal_workflow = context.portal_workflow
portal_workflow.doActionFor(context, action='edit_action', comment='Visited by Instance_tryToGarbageCollectNonAllocatedRootTree') """ )
transaction.commit()
def _dropInstance_tryToGarbageCollectNonAllocatedRootTree(self):
script_name = 'Instance_tryToGarbageCollectNonAllocatedRootTree'
if script_name in self.portal.portal_skins.custom.objectIds():
self.portal.portal_skins.custom.manage_delObjects(script_name)
transaction.commit()
def test_alarm(self): def test_alarm(self):
instance = self.createInstance() instance = self.createInstance()
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollectNonAllocatedRootTree() self._simulateScript("SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree")
try: try:
self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollectNonAllocatedRootTree() self._dropScript('SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree')
self.assertEqual( self.assertEqual(
'Visited by Instance_tryToGarbageCollectNonAllocatedRootTree', 'Visited by SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree',
instance.workflow_history['edit_workflow'][-1]['comment']) instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_invalidated(self): def test_alarm_invalidated(self):
instance = self.createInstance() instance = self.createInstance()
instance.invalidate() instance.invalidate()
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollectNonAllocatedRootTree() self._simulateScript("SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree")
try: try:
self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollectNonAllocatedRootTree() self._dropScript('SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToGarbageCollectNonAllocatedRootTree', 'Visited by SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree',
instance.workflow_history['edit_workflow'][-1]['comment']) instance.workflow_history['edit_workflow'][-1]['comment'])
def test_alarm_allocated(self): def test_alarm_allocated(self):
...@@ -1019,14 +965,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I ...@@ -1019,14 +965,14 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by I
partition = self.createComputerPartition() partition = self.createComputerPartition()
instance.edit(aggregate_value=partition) instance.edit(aggregate_value=partition)
self.tic() self.tic()
self._simulateInstance_tryToGarbageCollectNonAllocatedRootTree() self._simulateScript("SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree")
try: try:
self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense() self.portal.portal_alarms.slapos_garbage_collect_non_allocated_root_tree.activeSense()
self.tic() self.tic()
finally: finally:
self._dropInstance_tryToGarbageCollectNonAllocatedRootTree() self._dropScript('SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree')
self.assertNotEqual( self.assertNotEqual(
'Visited by Instance_tryToGarbageCollectNonAllocatedRootTree', 'Visited by SoftwareInstance_tryToGarbageCollectNonAllocatedRootTree',
instance.workflow_history['edit_workflow'][-1]['comment']) instance.workflow_history['edit_workflow'][-1]['comment'])
class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin): class TestSlapOSGarbageCollectUnlinkedInstanceAlarm(SlapOSTestCaseMixin):
......
...@@ -100,11 +100,13 @@ ...@@ -100,11 +100,13 @@
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<key> <string>_log</string> </key>
<value>
<list> <list>
<dictionary> <dictionary>
<item> <item>
...@@ -117,7 +119,9 @@ ...@@ -117,7 +119,9 @@
</item> </item>
</dictionary> </dictionary>
</list> </list>
</tuple> </value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Customer of the partition</property> <property id='title'>Customer of the partition</property>
<property id='condition'>python: here.getSlapState() == "busy"</property> <property id='condition'>python: here.getSlapState() == "busy"</property>
<property id='base_category_script'>PartitionType_getSecurityCategoryFromUser</property> <property id='base_category_script'>ComputerPartition_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Allocation scope</property> <property id='title'>Allocation scope</property>
<property id='condition'>python: here.getAllocationScope('').startswith('open')</property> <property id='condition'>python: here.getAllocationScope('').startswith('open')</property>
<property id='base_category_script'>ComputerType_getSecurityCategoryFromAllocationScope</property> <property id='base_category_script'>Computer_getSecurityCategoryFromAllocationScope</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<role id='Auditor'> <role id='Auditor'>
<property id='title'>Shadow User</property> <property id='title'>Shadow User</property>
<property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property> <property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property>
<property id='base_category_script'>PaymentTransactionType_getSecurityCategoryFromUser</property> <property id='base_category_script'>PaymentTransaction_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Shadow User</property> <property id='title'>Shadow User</property>
<property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property> <property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property>
<property id='base_category_script'>PayzenEventType_getSecurityCategoryFromUser</property> <property id='base_category_script'>PayzenEvent_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<property id='title'>The Shadow User Himself</property> <property id='title'>The Shadow User Himself</property>
<property id='description'>Monovalued role</property> <property id='description'>Monovalued role</property>
<property id='condition'>python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login", "Certificate Login"])</property> <property id='condition'>python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login", "Certificate Login"])</property>
<property id='base_category_script'>PersonType_getSecurityCategoryFromSelfShadow</property> <property id='base_category_script'>Person_getSecurityCategoryFromSelfShadow</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </role>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Customer of the Instance</property> <property id='title'>Customer of the Instance</property>
<property id='base_category_script'>InstanceType_getSecurityCategoryFromUser</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
...@@ -25,19 +25,19 @@ ...@@ -25,19 +25,19 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Organisation Member</property> <property id='title'>Organisation Member</property>
<property id='base_category_script'>Instance_getSecurityCategoryFromMovementSpecialiseDestination</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property> <multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Project Member</property> <property id='title'>Project Member</property>
<property id='base_category_script'>Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property> <multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property> <multi_property id='base_category'>destination_project</multi_property>
</role> </role>
<role id='Assignor'> <role id='Assignor'>
<property id='title'>Software Instance which provides this Slave Instance</property> <property id='title'>Software Instance which provides this Slave Instance</property>
<property id='base_category_script'>SlaveInstanceType_getSecurityCategoryFromSoftwareInstance</property> <property id='base_category_script'>SlaveInstance_getSecurityCategoryFromSoftwareInstance</property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
</type_roles> </type_roles>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Customer of the Instance</property> <property id='title'>Customer of the Instance</property>
<property id='base_category_script'>InstanceType_getSecurityCategoryFromUser</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/user</multi_property> <multi_property id='categories'>local_role_group/user</multi_property>
<multi_property id='base_category'>destination_section</multi_property> <multi_property id='base_category'>destination_section</multi_property>
</role> </role>
...@@ -25,13 +25,13 @@ ...@@ -25,13 +25,13 @@
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Organisation Member</property> <property id='title'>Organisation Member</property>
<property id='base_category_script'>Instance_getSecurityCategoryFromMovementSpecialiseDestination</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination</property>
<multi_property id='categories'>local_role_group/organisation</multi_property> <multi_property id='categories'>local_role_group/organisation</multi_property>
<multi_property id='base_category'>destination</multi_property> <multi_property id='base_category'>destination</multi_property>
</role> </role>
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Project Member</property> <property id='title'>Project Member</property>
<property id='base_category_script'>Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject</property> <property id='base_category_script'>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject</property>
<multi_property id='categories'>local_role_group/project</multi_property> <multi_property id='categories'>local_role_group/project</multi_property>
<multi_property id='base_category'>destination_project</multi_property> <multi_property id='base_category'>destination_project</multi_property>
</role> </role>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<role id='Assignee'> <role id='Assignee'>
<property id='title'>Shadow User</property> <property id='title'>Shadow User</property>
<property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property> <property id='condition'>python: here.getDestinationSection('', portal_type='Person') != ''</property>
<property id='base_category_script'>PayzenEventType_getSecurityCategoryFromUser</property> <property id='base_category_script'>PayzenEvent_getSecurityCategoryFromUser</property>
<multi_property id='categories'>local_role_group/shadow</multi_property> <multi_property id='categories'>local_role_group/shadow</multi_property>
<multi_property id='base_category'>aggregate</multi_property> <multi_property id='base_category'>aggregate</multi_property>
</role> </role>
......
...@@ -3900,7 +3900,7 @@ slapos_contract;CloudContractModule_viewCloudContractList;ERP5 Form;567bc1d268f1 ...@@ -3900,7 +3900,7 @@ slapos_contract;CloudContractModule_viewCloudContractList;ERP5 Form;567bc1d268f1
slapos_contract;CloudContract_view;ERP5 Form;567bc1d268f135496de3d5b946b691f3 slapos_contract;CloudContract_view;ERP5 Form;567bc1d268f135496de3d5b946b691f3
slapos_contract;Person_isAllowedToAllocate;Script (Python);1011560d667674a6dc682278576fdac3 slapos_contract;Person_isAllowedToAllocate;Script (Python);1011560d667674a6dc682278576fdac3
slapos_contract;SoftwareInstance_requestValidationPayment;Script (Python);870ea0066ada7e7c82927fe6cdb699bc slapos_contract;SoftwareInstance_requestValidationPayment;Script (Python);870ea0066ada7e7c82927fe6cdb699bc
slapos_core;ComputerType_getSecurityCategoryFromAllocationScope;Script (Python);026c89445871f2338f2b2f7516f62b5e slapos_core;Computer_getSecurityCategoryFromAllocationScope;Script (Python);026c89445871f2338f2b2f7516f62b5e
slapos_core;ERP5Site_viewWorklist;ERP5 Form;567bc1d268f135496de3d5b946b691f3 slapos_core;ERP5Site_viewWorklist;ERP5 Form;567bc1d268f135496de3d5b946b691f3
slapos_core;ERP5Type_acquireSecurityFromOwner;Script (Python);6b0ecba5c6bd74065cbc83d2a823f4a3 slapos_core;ERP5Type_acquireSecurityFromOwner;Script (Python);6b0ecba5c6bd74065cbc83d2a823f4a3
slapos_core;ERP5Type_getComputerSecurityCategory;External Method;d41d8cd98f00b204e9800998ecf8427e slapos_core;ERP5Type_getComputerSecurityCategory;External Method;d41d8cd98f00b204e9800998ecf8427e
...@@ -3910,19 +3910,19 @@ slapos_core;ERP5Type_getSecurityCategoryFromContentParent;Script (Python);5331a6 ...@@ -3910,19 +3910,19 @@ slapos_core;ERP5Type_getSecurityCategoryFromContentParent;Script (Python);5331a6
slapos_core;ERP5Type_getSecurityCategoryFromParent;Script (Python);a8d13633bb50363ea5b180f8d65ccde8 slapos_core;ERP5Type_getSecurityCategoryFromParent;Script (Python);a8d13633bb50363ea5b180f8d65ccde8
slapos_core;ERP5Type_getSecurityCategoryMapping;Script (Python);c488f23e5ce532818351e35b7677b8f7 slapos_core;ERP5Type_getSecurityCategoryMapping;Script (Python);c488f23e5ce532818351e35b7677b8f7
slapos_core;ERP5Type_getSoftwareInstanceSecurityCategory;External Method;d41d8cd98f00b204e9800998ecf8427e slapos_core;ERP5Type_getSoftwareInstanceSecurityCategory;External Method;d41d8cd98f00b204e9800998ecf8427e
slapos_core;InstanceType_getSecurityCategoryFromUser;Script (Python);6ef7c7d387802d420282ae13a4bd7de6 slapos_core;SoftwareInstance_getSecurityCategoryFromUser;Script (Python);6ef7c7d387802d420282ae13a4bd7de6
slapos_core;Instance_getSecurityCategoryFromMovementSpecialiseDestination;Script (Python);856f6ba3157e8ea3c78b2d590345d68d slapos_core;Instance_getSecurityCategoryFromMovementSpecialiseDestination;Script (Python);856f6ba3157e8ea3c78b2d590345d68d
slapos_core;Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject;Script (Python);e3c875ff319f7242f3eeb480c0db499d slapos_core;SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject;Script (Python);e3c875ff319f7242f3eeb480c0db499d
slapos_core;Item_getSecurityCategoryFromMovementAggregateDestinationProject;Script (Python);f3b6a577753f82221a7aa6dc7b78f730 slapos_core;Item_getSecurityCategoryFromMovementAggregateDestinationProject;Script (Python);f3b6a577753f82221a7aa6dc7b78f730
slapos_core;Item_getSecurityCategoryFromMovementAggregateDestinationSection;Script (Python);32945204cbeca4d40ecd308649803c84 slapos_core;Item_getSecurityCategoryFromMovementAggregateDestinationSection;Script (Python);32945204cbeca4d40ecd308649803c84
slapos_core;Item_getSecurityCategoryFromMovementDestination;Script (Python);3a29e4120d2afcbe0472a6a7716042f5 slapos_core;Item_getSecurityCategoryFromMovementDestination;Script (Python);3a29e4120d2afcbe0472a6a7716042f5
slapos_core;Item_getSecurityCategoryFromMovementDestinationProject;Script (Python);88fe76159d022151d8373d3d0cc7cbfe slapos_core;Item_getSecurityCategoryFromMovementDestinationProject;Script (Python);88fe76159d022151d8373d3d0cc7cbfe
slapos_core;Item_getSecurityCategoryFromMovementDestinationSection;Script (Python);2f02ca4fd91d6266adb0b8ac52bf54f6 slapos_core;Item_getSecurityCategoryFromMovementDestinationSection;Script (Python);2f02ca4fd91d6266adb0b8ac52bf54f6
slapos_core;PartitionType_getSecurityCategoryFromUser;Script (Python);1890e2a89e76cdf93b9180c7b345e6a6 slapos_core;ComputerPartition_getSecurityCategoryFromUser;Script (Python);1890e2a89e76cdf93b9180c7b345e6a6
slapos_core;PaymentTransactionType_getSecurityCategoryFromUser;Script (Python);62c11bd590265c8ab24574a923d44e7d slapos_core;PaymentTransaction_getSecurityCategoryFromUser;Script (Python);62c11bd590265c8ab24574a923d44e7d
slapos_core;PayzenEventType_getSecurityCategoryFromUser;Script (Python);ae3782f48d74f8b3f076212ac6ad8afc slapos_core;PayzenEvent_getSecurityCategoryFromUser;Script (Python);ae3782f48d74f8b3f076212ac6ad8afc
slapos_core;PersonType_getSecurityCategoryFromSelfShadow;Script (Python);fc74fcc1cad0ada14b9b6c3d4b77a5a1 slapos_core;Person_getSecurityCategoryFromSelfShadow;Script (Python);fc74fcc1cad0ada14b9b6c3d4b77a5a1
slapos_core;SlaveInstanceType_getSecurityCategoryFromSoftwareInstance;Script (Python);5f8786f3df83a837ab947fc5d15f5cae slapos_core;SlaveInstance_getSecurityCategoryFromSoftwareInstance;Script (Python);5f8786f3df83a837ab947fc5d15f5cae
slapos_crm;Alarm_cancelInvoiceRelatedToSuspendedRegularisationRequest;Script (Python);8fe12acf0214090c706ed25f56f4be44 slapos_crm;Alarm_cancelInvoiceRelatedToSuspendedRegularisationRequest;Script (Python);8fe12acf0214090c706ed25f56f4be44
slapos_crm;Alarm_createRegularisationRequest;Script (Python);03d5146c85e93af9d03df0ac3219248a slapos_crm;Alarm_createRegularisationRequest;Script (Python);03d5146c85e93af9d03df0ac3219248a
slapos_crm;Alarm_deleteHostingSubscriptionFromRegularisationRequest;Script (Python);85544411d0dee68a7ffe4b3415a21046 slapos_crm;Alarm_deleteHostingSubscriptionFromRegularisationRequest;Script (Python);85544411d0dee68a7ffe4b3415a21046
......
...@@ -283,7 +283,7 @@ Computer ...@@ -283,7 +283,7 @@ Computer
Condition: python: here.getAllocationScope('').startswith('open') Condition: python: here.getAllocationScope('').startswith('open')
Local Roles Group Id: shadow Local Roles Group Id: shadow
Base Categories: ['aggregate'] Base Categories: ['aggregate']
Base Category Script: ComputerType_getSecurityCategoryFromAllocationScope Base Category Script: Computer_getSecurityCategoryFromAllocationScope
Categories: [] Categories: []
Computer Computer
...@@ -499,7 +499,7 @@ Computer Partition ...@@ -499,7 +499,7 @@ Computer Partition
Condition: python: here.getSlapState() == "busy" Condition: python: here.getSlapState() == "busy"
Local Roles Group Id: user Local Roles Group Id: user
Base Categories: ['destination_section'] Base Categories: ['destination_section']
Base Category Script: PartitionType_getSecurityCategoryFromUser Base Category Script: ComputerPartition_getSecurityCategoryFromUser
Categories: [] Categories: []
Computer Partition Computer Partition
...@@ -1300,7 +1300,7 @@ Payment Transaction ...@@ -1300,7 +1300,7 @@ Payment Transaction
Condition: python: here.getDestinationSection('', portal_type='Person') != '' Condition: python: here.getDestinationSection('', portal_type='Person') != ''
Local Roles Group Id: shadow Local Roles Group Id: shadow
Base Categories: ['aggregate'] Base Categories: ['aggregate']
Base Category Script: PaymentTransactionType_getSecurityCategoryFromUser Base Category Script: PaymentTransaction_getSecurityCategoryFromUser
Categories: [] Categories: []
Payment Transaction Payment Transaction
...@@ -1327,7 +1327,7 @@ Payzen Event ...@@ -1327,7 +1327,7 @@ Payzen Event
Condition: python: here.getDestinationSection('', portal_type='Person') != '' Condition: python: here.getDestinationSection('', portal_type='Person') != ''
Local Roles Group Id: shadow Local Roles Group Id: shadow
Base Categories: ['aggregate'] Base Categories: ['aggregate']
Base Category Script: PayzenEventType_getSecurityCategoryFromUser Base Category Script: PayzenEvent_getSecurityCategoryFromUser
Categories: [] Categories: []
Person Person
...@@ -1345,7 +1345,7 @@ Person ...@@ -1345,7 +1345,7 @@ Person
Condition: python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login", "Certificate Login"]) Condition: python: here.objectValues(portal_type=["ERP5 Login", "Google Login", "Facebook Login", "Certificate Login"])
Local Roles Group Id: shadow Local Roles Group Id: shadow
Base Categories: ['group'] Base Categories: ['group']
Base Category Script: PersonType_getSecurityCategoryFromSelfShadow Base Category Script: Person_getSecurityCategoryFromSelfShadow
Categories: [] Categories: []
Person Person
...@@ -1885,7 +1885,7 @@ Slave Instance ...@@ -1885,7 +1885,7 @@ Slave Instance
Condition: None Condition: None
Local Roles Group Id: user Local Roles Group Id: user
Base Categories: ['destination_section'] Base Categories: ['destination_section']
Base Category Script: InstanceType_getSecurityCategoryFromUser Base Category Script: SoftwareInstance_getSecurityCategoryFromUser
Categories: [] Categories: []
Slave Instance Slave Instance
...@@ -1912,7 +1912,7 @@ Slave Instance ...@@ -1912,7 +1912,7 @@ Slave Instance
Condition: None Condition: None
Local Roles Group Id: organisation Local Roles Group Id: organisation
Base Categories: ['destination'] Base Categories: ['destination']
Base Category Script: Instance_getSecurityCategoryFromMovementSpecialiseDestination Base Category Script: SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination
Categories: [] Categories: []
Slave Instance Slave Instance
...@@ -1921,7 +1921,7 @@ Slave Instance ...@@ -1921,7 +1921,7 @@ Slave Instance
Condition: None Condition: None
Local Roles Group Id: project Local Roles Group Id: project
Base Categories: ['destination_project'] Base Categories: ['destination_project']
Base Category Script: Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject Base Category Script: SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject
Categories: [] Categories: []
Slave Instance Slave Instance
...@@ -1930,7 +1930,7 @@ Slave Instance ...@@ -1930,7 +1930,7 @@ Slave Instance
Condition: None Condition: None
Local Roles Group Id: None Local Roles Group Id: None
Base Categories: ['aggregate'] Base Categories: ['aggregate']
Base Category Script: SlaveInstanceType_getSecurityCategoryFromSoftwareInstance Base Category Script: SlaveInstance_getSecurityCategoryFromSoftwareInstance
Categories: [] Categories: []
Software Installation Software Installation
...@@ -2020,7 +2020,7 @@ Software Instance ...@@ -2020,7 +2020,7 @@ Software Instance
Condition: None Condition: None
Local Roles Group Id: user Local Roles Group Id: user
Base Categories: ['destination_section'] Base Categories: ['destination_section']
Base Category Script: InstanceType_getSecurityCategoryFromUser Base Category Script: SoftwareInstance_getSecurityCategoryFromUser
Categories: [] Categories: []
Software Instance Software Instance
...@@ -2047,7 +2047,7 @@ Software Instance ...@@ -2047,7 +2047,7 @@ Software Instance
Condition: None Condition: None
Local Roles Group Id: organisation Local Roles Group Id: organisation
Base Categories: ['destination'] Base Categories: ['destination']
Base Category Script: Instance_getSecurityCategoryFromMovementSpecialiseDestination Base Category Script: SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination
Categories: [] Categories: []
Software Instance Software Instance
...@@ -2056,7 +2056,7 @@ Software Instance ...@@ -2056,7 +2056,7 @@ Software Instance
Condition: None Condition: None
Local Roles Group Id: project Local Roles Group Id: project
Base Categories: ['destination_project'] Base Categories: ['destination_project']
Base Category Script: Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject Base Category Script: SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject
Categories: [] Categories: []
Software Instance Module Software Instance Module
...@@ -2434,6 +2434,6 @@ Wechat Event ...@@ -2434,6 +2434,6 @@ Wechat Event
Condition: python: here.getDestinationSection('', portal_type='Person') != '' Condition: python: here.getDestinationSection('', portal_type='Person') != ''
Local Roles Group Id: shadow Local Roles Group Id: shadow
Base Categories: ['aggregate'] Base Categories: ['aggregate']
Base Category Script: PayzenEventType_getSecurityCategoryFromUser Base Category Script: PayzenEvent_getSecurityCategoryFromUser
Categories: [] Categories: []
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>PayzenEventType_getSecurityCategoryFromUser</string> </value> <value> <string>ComputerPartition_getSecurityCategoryFromUser</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>PaymentTransactionType_getSecurityCategoryFromUser</string> </value> <value> <string>Computer_getSecurityCategoryFromAllocationScope</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PaymentTransaction_getSecurityCategoryFromUser</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -32,7 +32,7 @@ if obj is None: ...@@ -32,7 +32,7 @@ if obj is None:
person = obj.getDestinationSectionValue(portal_type="Person") person = obj.getDestinationSectionValue(portal_type="Person")
if person is not None: if person is not None:
for base_category in base_category_list: if base_category_list:
return {"Assignee": ["SHADOW-%s" % person.getUserId()]} return {"Assignee": ["SHADOW-%s" % person.getUserId()]}
return category_list return category_list
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>InstanceType_getSecurityCategoryFromUser</string> </value> <value> <string>PayzenEvent_getSecurityCategoryFromUser</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>PersonType_getSecurityCategoryFromSelfShadow</string> </value> <value> <string>Person_getSecurityCategoryFromSelfShadow</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>_params</string> </key>
<value> <string>base_category_list, user_name, obj, portal_type</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlaveInstanceType_getSecurityCategoryFromSoftwareInstance</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>ComputerType_getSecurityCategoryFromAllocationScope</string> </value> <value> <string>SlaveInstance_getSecurityCategoryFromSoftwareInstance</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_getSecurityCategoryFromMovementSpecialiseDestinationProject</string> </value> <value> <string>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestination</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Instance_getSecurityCategoryFromMovementSpecialiseDestination</string> </value> <value> <string>SoftwareInstance_getSecurityCategoryFromMovementSpecialiseDestinationProject</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>PartitionType_getSecurityCategoryFromUser</string> </value> <value> <string>SoftwareInstance_getSecurityCategoryFromUser</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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