Commit 52dc1b8d authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Romain Courteaud

slapgrid: Move to new allDocs structure and use get_parameters

parent 62daf04a
......@@ -1142,10 +1142,7 @@ stderr_logfile_backups=1
}).get("result_list", [])
for instance_result in related_instance_list:
if instance_result["reference"] != computer_partition["reference"]:
instance = self.slap.jio_api_connector.get({
"portal_type": "Software Instance",
"reference": instance_result["reference"],
})
instance = self.slap.jio_api_connector.get(instance_result["get_parameters"])
hosting_ip_list = hosting_ip_list + instance["ip_list"]
else:
hosting_ip_list = computer_partition["slap_partition"].getFullHostingIpAddressList()
......@@ -1631,10 +1628,7 @@ stderr_logfile_backups=1
# even if something is terribly wrong while processing an instance, it
# won't prevent processing other ones.
if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
try:
# Process the partition itself
self.processComputerPartition(computer_partition)
......@@ -1759,10 +1753,7 @@ stderr_logfile_backups=1
promise_error_partition_list = []
for computer_partition in computer_partition_list:
if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
try:
# Process the partition itself
self.processPromise(computer_partition)
......@@ -2076,10 +2067,7 @@ stderr_logfile_backups=1
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"]
})
computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
local_partition = Partition(
software_path=software_path,
......
......@@ -446,46 +446,85 @@ class ComputerForTest(object):
if (url.path == '/api/allDocs/'):
if content["portal_type"] == "Software Installation":
return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Installation",
"compute_node_id": content["compute_node_id"],
},
"result_list": [{
"software_release_uri": x.name,
"portal_type": "Software Installation",
"compute_node_id": content["compute_node_id"],
"state": x.requested_state
"state": x.requested_state,
"api_revision": "12121",
"get_parameters": {
"software_release_uri": x.name,
"portal_type": "Software Installation",
"compute_node_id": content["compute_node_id"],
}
} for x in self.software_list]
})
if content["portal_type"] == "Software Instance":
if "compute_node_id" in content:
if "compute_partition_id" in content:
return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"compute_partition_id": content["compute_partition_id"],
},
"result_list": [{
"software_release_uri": x.software.name if x.software else None,
"reference": x.name,
"title": x.name,
"portal_type": "Software Instance",
"compute_partition_id": x.name,
"state": x.requested_state
"state": x.requested_state,
"api_revision": "12132",
"get_parameters": {
"portal_type": "Software Instance",
"reference": x.name,
}
} for x in self.instance_list if x.name == content["compute_partition_id"]]
})
else:
return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"compute_node_id": content["compute_node_id"],
},
"result_list": [{
"software_release_uri": x.software.name if x.software else None,
"reference": x.name,
"title": x.name,
"portal_type": "Software Instance",
"compute_partition_id": x.name,
"state": x.requested_state
"state": x.requested_state,
"get_parameters": {
"portal_type": "Software Instance",
"reference": x.name,
}
} for x in self.instance_list]
})
elif "root_instance_title" in content:
return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"root_instance_title": content["root_instance_title"],
},
"result_list": [{
"software_release_uri": x.software.name if x.software else None,
"reference": x.name,
"title": x.name,
"portal_type": "Software Instance",
"compute_partition_id": x.name,
"state": x.requested_state
"state": x.requested_state,
"get_parameters": {
"portal_type": "Software Instance",
"reference": x.name,
},
} for x in self.instance_list] + [
{
"software_release_uri": "foo.cfg",
......@@ -493,7 +532,11 @@ class ComputerForTest(object):
"title": "related_instance",
"portal_type": "Software Instance",
"compute_partition_id": "related_instance",
"state": "stopped"
"state": "stopped",
"get_parameters": {
"portal_type": "Software Instance",
"reference": "related_instance",
}
}
]
})
......
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