Commit 956feb77 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

slapgrid: Move to new allDocs structure and use get_parameters

parent 66912dd6
...@@ -1127,10 +1127,7 @@ stderr_logfile_backups=1 ...@@ -1127,10 +1127,7 @@ stderr_logfile_backups=1
}).get("result_list", []) }).get("result_list", [])
for instance_result in related_instance_list: for instance_result in related_instance_list:
if instance_result["reference"] != computer_partition["reference"]: if instance_result["reference"] != computer_partition["reference"]:
instance = self.slap.jio_api_connector.get({ instance = self.slap.jio_api_connector.get(instance_result["get_parameters"])
"portal_type": "Software Instance",
"reference": instance_result["reference"],
})
hosting_ip_list = hosting_ip_list + instance["ip_list"] hosting_ip_list = hosting_ip_list + instance["ip_list"]
else: else:
hosting_ip_list = computer_partition["slap_partition"].getFullHostingIpAddressList() hosting_ip_list = computer_partition["slap_partition"].getFullHostingIpAddressList()
...@@ -1609,10 +1606,7 @@ stderr_logfile_backups=1 ...@@ -1609,10 +1606,7 @@ stderr_logfile_backups=1
# even if something is terribly wrong while processing an instance, it # even if something is terribly wrong while processing an instance, it
# won't prevent processing other ones. # won't prevent processing other ones.
if not self.api_backward_compatibility: if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({ computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
try: try:
# Process the partition itself # Process the partition itself
self.processComputerPartition(computer_partition) self.processComputerPartition(computer_partition)
...@@ -1685,10 +1679,7 @@ stderr_logfile_backups=1 ...@@ -1685,10 +1679,7 @@ stderr_logfile_backups=1
promise_error_partition_list = [] promise_error_partition_list = []
for computer_partition in computer_partition_list: for computer_partition in computer_partition_list:
if not self.api_backward_compatibility: if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({ computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
try: try:
# Process the partition itself # Process the partition itself
self.processPromise(computer_partition) self.processPromise(computer_partition)
...@@ -2001,10 +1992,7 @@ stderr_logfile_backups=1 ...@@ -2001,10 +1992,7 @@ stderr_logfile_backups=1
software_path = None software_path = None
if not self.api_backward_compatibility: if not self.api_backward_compatibility:
computer_partition = self.slap.jio_api_connector.get({ computer_partition = self.slap.jio_api_connector.get(computer_partition["get_parameters"])
"portal_type": "Software Instance",
"reference": computer_partition["reference"]
})
local_partition = Partition( local_partition = Partition(
software_path=software_path, software_path=software_path,
......
...@@ -442,46 +442,85 @@ class ComputerForTest(object): ...@@ -442,46 +442,85 @@ class ComputerForTest(object):
if (url.path == '/api/allDocs/'): if (url.path == '/api/allDocs/'):
if content["portal_type"] == "Software Installation": if content["portal_type"] == "Software Installation":
return json.dumps({ return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Installation",
"compute_node_id": content["compute_node_id"],
},
"result_list": [{ "result_list": [{
"software_release_uri": x.name, "software_release_uri": x.name,
"portal_type": "Software Installation", "portal_type": "Software Installation",
"compute_node_id": content["compute_node_id"], "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] } for x in self.software_list]
}) })
if content["portal_type"] == "Software Instance": if content["portal_type"] == "Software Instance":
if "compute_node_id" in content: if "compute_node_id" in content:
if "compute_partition_id" in content: if "compute_partition_id" in content:
return json.dumps({ return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"compute_partition_id": content["compute_partition_id"],
},
"result_list": [{ "result_list": [{
"software_release_uri": x.software.name if x.software else None, "software_release_uri": x.software.name if x.software else None,
"reference": x.name, "reference": x.name,
"title": x.name, "title": x.name,
"portal_type": "Software Instance", "portal_type": "Software Instance",
"compute_partition_id": x.name, "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"]] } for x in self.instance_list if x.name == content["compute_partition_id"]]
}) })
else: else:
return json.dumps({ return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"compute_node_id": content["compute_node_id"],
},
"result_list": [{ "result_list": [{
"software_release_uri": x.software.name if x.software else None, "software_release_uri": x.software.name if x.software else None,
"reference": x.name, "reference": x.name,
"title": x.name, "title": x.name,
"portal_type": "Software Instance", "portal_type": "Software Instance",
"compute_partition_id": x.name, "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] } for x in self.instance_list]
}) })
elif "root_instance_title" in content: elif "root_instance_title" in content:
return json.dumps({ return json.dumps({
"current_page_full": False,
"next_page_request": {
"portal_type": "Software Instance",
"root_instance_title": content["root_instance_title"],
},
"result_list": [{ "result_list": [{
"software_release_uri": x.software.name if x.software else None, "software_release_uri": x.software.name if x.software else None,
"reference": x.name, "reference": x.name,
"title": x.name, "title": x.name,
"portal_type": "Software Instance", "portal_type": "Software Instance",
"compute_partition_id": x.name, "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] + [ } for x in self.instance_list] + [
{ {
"software_release_uri": "foo.cfg", "software_release_uri": "foo.cfg",
...@@ -489,7 +528,11 @@ class ComputerForTest(object): ...@@ -489,7 +528,11 @@ class ComputerForTest(object):
"title": "related_instance", "title": "related_instance",
"portal_type": "Software Instance", "portal_type": "Software Instance",
"compute_partition_id": "related_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