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

slapos_jio_api_style: Instance parameter is expected in JSON

parent cbd84bbe
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
},\n },\n
"parameters": {\n "parameters": {\n
"title": "Instance Parameters",\n "title": "Instance Parameters",\n
"type": "object",\n "type": "string",\n
"additionalProperties": { "type": "string" }\n "description": "Instance parameters in JSON Format."\n
},\n },\n
"shared": {\n "shared": {\n
"title": "Shared Instance",\n "title": "Shared Instance",\n
......
...@@ -88,8 +88,8 @@ def getSoftwareInstanceForComputePartition(compute_node_id, ...@@ -88,8 +88,8 @@ def getSoftwareInstanceForComputePartition(compute_node_id,
# Loads partition parameter # Loads partition parameter
partition_parameter = data_dict.get("parameters", {}) partition_parameter = data_dict.get("parameters", None)
if isinstance(partition_parameter, str): if partition_parameter:
import json import json
try: try:
partition_parameter = json.loads(partition_parameter) partition_parameter = json.loads(partition_parameter)
...@@ -99,11 +99,13 @@ if isinstance(partition_parameter, str): ...@@ -99,11 +99,13 @@ if isinstance(partition_parameter, str):
error_name="CANNOT-DECODE-COMPUTER-PARTITION-JSON-PARAMETER", error_name="CANNOT-DECODE-COMPUTER-PARTITION-JSON-PARAMETER",
) )
if not isinstance(partition_parameter, dict): if not isinstance(partition_parameter, dict):
return logError( return logError(
"Parameters should be a key value object.", "Parameters should be a key value object.",
error_name="INCORRECT-COMPUTER-PARTITION-JSON-PARAMETER", error_name="INCORRECT-COMPUTER-PARTITION-JSON-PARAMETER",
) )
else:
partition_parameter = {}
try: try:
# filter dict # filter 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