Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got com.google.gson.JsonSyntaxException: java.lang.IllegalStateException when I try to get the job info with a Invalid JobId #194

Open
wheniworking opened this issue Mar 8, 2017 · 3 comments

Comments

@wheniworking
Copy link

wheniworking commented Mar 8, 2017

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

@ghost
Copy link

ghost commented Mar 13, 2017

What would be an appropriate return value in this case?

Maybe Jobs.listJob could return an Optional value? Or throwing a more informative exception?

@admd
Copy link
Contributor

admd commented Mar 13, 2017

Duplicate of #190

@lucidd
Copy link
Member

lucidd commented Mar 13, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants