Commit e09ba906 authored by Thomas Gambier's avatar Thomas Gambier Committed by Thomas Gambier

SlapTool: all instances of a stopped HS are stopped

parent fc7dd2fc
......@@ -100,11 +100,13 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -117,8 +119,9 @@
</item>
</dictionary>
</list>
<none/>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1862,6 +1862,41 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
if os.path.exists(self.instance_request_simulator):
os.unlink(self.instance_request_simulator)
def test_request_stopped(self):
self._makeComplexComputer()
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
partition_id = self.stop_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.stop_requested_software_instance.getUserId())
self.stop_requested_software_instance.requestInstance = Simulator(
self.instance_request_simulator, 'requestInstance')
response = self.portal_slap.requestComputerPartition(
computer_id=self.computer_id,
computer_partition_id=partition_id,
software_release='req_release',
software_type='req_type',
partition_reference='req_reference',
partition_parameter_xml='<marshal><dictionary id="i2"/></marshal>',
filter_xml='<marshal><dictionary id="i2"/></marshal>',
state='<marshal><string>started</string></marshal>',
shared_xml='<marshal><bool>0</bool></marshal>',
)
self.assertEqual(408, response.status)
self.assertEqual('private',
response.headers.get('cache-control'))
self.assertInstanceRequestSimulator((), {
'instance_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'software_title': 'req_reference',
'software_release': 'req_release',
'state': 'stopped',
'sla_xml': "<?xml version='1.0' encoding='utf-8'?>\n<instance/>\n",
'software_type': 'req_type',
'shared': False})
finally:
if os.path.exists(self.instance_request_simulator):
os.unlink(self.instance_request_simulator)
def test_updateInstancePredecessorList(self):
self._makeComplexComputer()
......
......@@ -47,21 +47,21 @@
<value>
<tuple>
<string>W: 28, 10: Use of eval (eval-used)</string>
<string>W:537, 13: Use of eval (eval-used)</string>
<string>W:592, 13: Use of eval (eval-used)</string>
<string>W:829, 13: Use of eval (eval-used)</string>
<string>W:1446, 13: Use of eval (eval-used)</string>
<string>W:1649, 13: Use of eval (eval-used)</string>
<string>W:1707, 13: Use of eval (eval-used)</string>
<string>W:1747, 13: Use of eval (eval-used)</string>
<string>W:2306, 13: Use of eval (eval-used)</string>
<string>W:2699, 13: Use of eval (eval-used)</string>
<string>W:2757, 13: Use of eval (eval-used)</string>
<string>W:2784, 13: Use of eval (eval-used)</string>
<string>W:2941, 13: Use of eval (eval-used)</string>
<string>W:2969, 13: Use of eval (eval-used)</string>
<string>W:3018, 13: Use of eval (eval-used)</string>
<string>W:3065, 13: Use of eval (eval-used)</string>
<string>W:545, 13: Use of eval (eval-used)</string>
<string>W:602, 13: Use of eval (eval-used)</string>
<string>W:851, 13: Use of eval (eval-used)</string>
<string>W:1480, 13: Use of eval (eval-used)</string>
<string>W:1689, 13: Use of eval (eval-used)</string>
<string>W:1749, 13: Use of eval (eval-used)</string>
<string>W:1789, 13: Use of eval (eval-used)</string>
<string>W:2396, 13: Use of eval (eval-used)</string>
<string>W:2803, 13: Use of eval (eval-used)</string>
<string>W:2863, 13: Use of eval (eval-used)</string>
<string>W:2890, 13: Use of eval (eval-used)</string>
<string>W:3047, 13: Use of eval (eval-used)</string>
<string>W:3075, 13: Use of eval (eval-used)</string>
<string>W:3124, 13: Use of eval (eval-used)</string>
<string>W:3171, 13: Use of eval (eval-used)</string>
</tuple>
</value>
</item>
......@@ -117,11 +117,13 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -134,8 +136,9 @@
</item>
</dictionary>
</list>
<none/>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -100,11 +100,13 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
......@@ -117,7 +119,9 @@
</item>
</dictionary>
</list>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1288,6 +1288,9 @@ class SlapTool(BaseTool):
software_instance_document = self.\
_getSoftwareInstanceForComputerPartition(computer_id,
computer_partition_id)
hosting_subscription = software_instance_document.getSpecialiseValue()
if hosting_subscription is not None and hosting_subscription.getSlapState() == "stop_requested":
state = 'stopped'
kw = dict(software_release=software_release,
software_type=software_type,
software_title=partition_reference,
......
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