salt-netapi-client
salt-netapi-client copied to clipboard
Got com.google.gson.JsonSyntaxException: java.lang.IllegalStateException when I try to get the job info with a Invalid JobId
I use Jobs.listJob(jid).callSync(saltClient) to get the JobInfo . If the jid is invalid for example 123 , I will get a IllegalStateException . com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_ARRAY at line 1 column 107 path $.return[0].Target-type However i run the command in shell $ salt-run jobs.list_job 123
I will get the result like this: Arguments: Function: unknown-function Result: ---------- StartTime: Target: unknown-target Target-type: User: root jid: 123
What would be an appropriate return value in this case?
Maybe Jobs.listJob could return an Optional value? Or throwing a more informative exception?
Duplicate of #190
looks like the problem here is that
{
"Function": "unknown-function",
"jid": 1,
"Result": {},
"Target": "unknown-target",
"StartTime": "",
"Target-type": [],
"Arguments": [],
"User": "root"
}
Target-type is suddenly an array instead of a String. I see no reason for it being an array so i suspect a bug in salt.