Commit 63cc4b06 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slapgrid: get Partition before processing it in report

parent 74983ca7
...@@ -1979,6 +1979,12 @@ stderr_logfile_backups=1 ...@@ -1979,6 +1979,12 @@ stderr_logfile_backups=1
# Try to process it anyway, it may need to be deleted. # Try to process it anyway, it may need to be deleted.
software_path = None software_path = None
if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
local_partition = Partition( local_partition = Partition(
software_path=software_path, software_path=software_path,
instance_path=os.path.join(self.instance_root, instance_path=os.path.join(self.instance_root,
......
...@@ -2042,10 +2042,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase): ...@@ -2042,10 +2042,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertEqual(computer.sequence, self.assertEqual(computer.sequence,
['/api/allDocs/', ['/api/allDocs/',
'/api/get/',
'/api/put/', '/api/put/',
'/api/put/']) '/api/put/'])
self.assertEqual(instance.sequence[0][1]["reported_state"], 'stopped') self.assertEqual(instance.sequence[1][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'destroyed') self.assertEqual(instance.sequence[2][1]["reported_state"], 'destroyed')
self.assertEqual(instance.state, 'destroyed') self.assertEqual(instance.state, 'destroyed')
def test_partition_list_is_complete_if_empty_destroyed_partition(self): def test_partition_list_is_complete_if_empty_destroyed_partition(self):
...@@ -2076,10 +2077,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase): ...@@ -2076,10 +2077,11 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
self.assertEqual(computer.sequence, self.assertEqual(computer.sequence,
['/api/allDocs/', ['/api/allDocs/',
'/api/get/',
'/api/put/', '/api/put/',
'/api/put/']) '/api/put/'])
self.assertEqual(instance.sequence[0][1]["reported_state"], 'stopped') self.assertEqual(instance.sequence[1][1]["reported_state"], 'stopped')
self.assertEqual(instance.sequence[1][1]["reported_state"], 'destroyed') self.assertEqual(instance.sequence[2][1]["reported_state"], 'destroyed')
self.assertEqual(instance.state, 'destroyed') self.assertEqual(instance.state, 'destroyed')
def test_slapgrid_not_destroy_bad_instance(self): def test_slapgrid_not_destroy_bad_instance(self):
......
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