Commit 75ee5953 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Romain Courteaud

slapos_jio_api_style: Add get instance from compute node and compute partition

This is useful for backward compatibility
parent 40b58c27
......@@ -66,14 +66,26 @@
},\n
{\n
"properties": {\n
"id": {\n
"title": "ID",\n
"compute_node_id": {\n
"title": "Compute Node Id",\n
"type": "string",\n
"description": "Unique Id of the object. This ID is defined by KD Portal. It is not editable."\n
"description": "Id Of the Requesting Compute Node, used by Slap Client when an instance is requesting an instance"\n
},\n
"compute_partition_id": {\n
"title": "Compute Partition Id",\n
"type": "string",\n
"description": "Id Of the Requesting Compute Partition, used by Slap Client when an instance is requesting an instance"\n
},\n
"portal_type": {\n
"title": "Portal Type",\n
"const": "Software Instance",\n
"type": "string"\n
}\n
},\n
"required": [\n
"id"\n
"compute_node_id",\n
"compute_partition_id",\n
"portal_type"\n
]\n
}\n
]\n
......
......@@ -29,6 +29,13 @@ elif portal_type == "Software Instance":
)
if software_instance:
return software_instance
elif "compute_node_id" and "compute_partition_id" in data_dict:
compute_partition = portal.portal_catalog.getComputePartitionObject(
data_dict["compute_node_id"],
data_dict["compute_partition_id"],
)
if compute_partition:
return compute_partition.getSoftwareInstance()
elif portal_type == "Software Instance Certificate Record":
if "reference" in data_dict:
......
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