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

slapos_jio_api_style: Fix Search Shared Instance

parent 8c4f8a7d
...@@ -40,40 +40,70 @@ ...@@ -40,40 +40,70 @@
"description": "Contains a representation of the items",\n "description": "Contains a representation of the items",\n
"type": "array",\n "type": "array",\n
"items": {\n "items": {\n
"type": "object",\n "anyOf": [\n
"title": "Item",\n {\n
"properties": {\n "type": "object",\n
"reference": {\n "title": "Software Instance",\n
"title": "Software Instance Reference",\n "properties": {\n
"description": "Unique identifier of the Software Instance",\n "reference": {\n
"type": "string"\n "title": "Software Instance Reference",\n
"description": "Unique identifier of the Software Instance",\n
"type": "string"\n
},\n
"title": {\n
"title": "Unique Title of the Instance",\n
"type": "string"\n
},\n
"state": {\n
"title": "Requested State",\n
"type": "string",\n
"enum": ["started", "stopped", "destroyed"],\n
"description": "State of the requested instance. It is functionnal when started. In stopped state, all services are stopped. If destroyed, it will remove the 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
"software_release_uri": {\n
"title": "Software Release URI",\n
"type": "string",\n
"description": "URL of the software release used by the software instance"\n
},\n
"portal_type": {\n
"title": "Portal Type",\n
"const": "Software Instance",\n
"type": "string"\n
}\n
}\n
},\n },\n
"title": {\n {\n
"title": "Unique Title of the Instance",\n "type": "object",\n
"type": "string"\n "title": "Shared Instance",\n
},\n "properties": {\n
"state": {\n "reference": {\n
"title": "Requested State",\n "title": "Software Instance Reference",\n
"type": "string",\n "description": "Unique identifier of the Software Instance",\n
"enum": ["started", "stopped", "destroyed"],\n "type": "string"\n
"description": "State of the requested instance. It is functionnal when started. In stopped state, all services are stopped. If destroyed, it will remove the instance."\n },\n
},\n "title": {\n
"compute_partition_id": {\n "title": "Unique Title of the Instance",\n
"title": "Compute Partition Id",\n "type": "string"\n
"type": "string",\n },\n
"description": "Id Of the Requesting Compute Partition, used by Slap Client when an instance is requesting an instance"\n "state": {\n
},\n "title": "Requested State",\n
"software_release_uri": {\n "type": "string",\n
"title": "Software Release URI",\n "enum": ["started", "stopped", "destroyed"],\n
"type": "string",\n "description": "State of the requested instance. It is functionnal when started. In stopped state, all services are stopped. If destroyed, it will remove the instance."\n
"description": "URL of the software release used by the software instance"\n },\n
},\n "portal_type": {\n
"portal_type": {\n "title": "Portal Type",\n
"title": "Portal Type",\n "const": "Shared Instance",\n
"const": "Software Instance",\n "type": "string"\n
"type": "string"\n }\n
}\n
}\n }\n
}\n ]\n
}\n }\n
}\n }\n
}\n }\n
......
...@@ -44,7 +44,7 @@ elif portal_type == "Shared Instance": ...@@ -44,7 +44,7 @@ elif portal_type == "Shared Instance":
search_kw = { search_kw = {
"portal_type": "Slave Instance", "portal_type": "Slave Instance",
"validation_state": "validated", "validation_state": "validated",
"select_list": ("title", "reference", "portal_type", "slap_state", "aggregate_reference", "url_string") "select_list": ("title", "reference", "portal_type", "slap_state", "aggregate_reference")
} }
if "host_instance_reference" in data_dict: if "host_instance_reference" in data_dict:
host_instance_list = portal.portal_catalog( host_instance_list = portal.portal_catalog(
...@@ -66,10 +66,11 @@ elif portal_type == "Shared Instance": ...@@ -66,10 +66,11 @@ elif portal_type == "Shared Instance":
result_list = [{ result_list = [{
"title": x.title, "title": x.title,
"reference": x.reference, "reference": x.reference,
"portal_type": x.portal_type, "portal_type": "Shared Instance",
"state": x.slap_state, "state": slap_state_dict.get(x.slap_state, ""),
"compute_partition_id": x.aggregate_reference, "compute_partition_id": x.aggregate_reference,
"software_release_uri": x.url_string, # Slave Instance don't have url_string cataloged. Selecting it return 0 result each time
#"software_release_uri": x.url_string,
} for x in portal.portal_catalog(**search_kw)] } for x in portal.portal_catalog(**search_kw)]
else: else:
......
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