Commit 981e8654 authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

slapos_jio_api_style: Instance parameter is expected in JSON

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