Commit a53497a8 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

slapgrid: Move to new allDocs structure and use get_parameters

parent fc8bfb4f
......@@ -1141,10 +1141,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()
......@@ -1630,10 +1627,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)
......@@ -1724,10 +1718,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)
......@@ -2041,10 +2032,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,
......
......@@ -444,46 +444,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",
......@@ -491,7 +530,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