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,8 +40,10 @@ ...@@ -40,8 +40,10 @@
"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
"anyOf": [\n
{\n
"type": "object",\n "type": "object",\n
"title": "Item",\n "title": "Software Instance",\n
"properties": {\n "properties": {\n
"reference": {\n "reference": {\n
"title": "Software Instance Reference",\n "title": "Software Instance Reference",\n
...@@ -74,6 +76,34 @@ ...@@ -74,6 +76,34 @@
"type": "string"\n "type": "string"\n
}\n }\n
}\n }\n
},\n
{\n
"type": "object",\n
"title": "Shared Instance",\n
"properties": {\n
"reference": {\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
"portal_type": {\n
"title": "Portal Type",\n
"const": "Shared Instance",\n
"type": "string"\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