execution-create and run_action API's if called with bad formatted json file raises ValueError
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-mistralclient |
New
|
Undecided
|
Dinesh Bhor |
Bug Description
API's like "execution-create" and "run_action" takes input in the json format and if they called with bad formatted json file then it raises ValueError which is not user friendly and doesn't give any clue to user what is wrong.
Steps to reproduce:
Command:
mistral --debug execution-create std.delete_instance input.json
input.json:
{
vm_namei: "my_test_
}
mistralclient debug logs:
Traceback (most recent call last):
File "/usr/local/
sys.
File "/usr/local/
return MistralShell(
File "/usr/local/
result = self.run_
File "/usr/local/
result = cmd.run(
File "/usr/local/
return super(Command, self).run(
File "/usr/local/
column_names, data = self.take_
File "/usr/local/
wf_input = utils.load_
File "/usr/local/
return json.load(fh)
File "/usr/lib/
**kw)
File "/usr/lib/
return _default_
File "/usr/lib/
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/
obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 2 column 5 (char 6)
It looks like if it fails to parse the json file properly then "json.load" returns the ValueError
which is not handled properly. It should be caught in "utils.load_json" and something like "Failed to parse input json file" should be returned.
Changed in python-mistralclient: | |
assignee: | nobody → Dinesh Bhor (dinesh-bhor) |