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

net.sf.json.JSONException: 'object' is an array. Use JSONArray instead #36

Closed
hoitsang opened this issue Jul 29, 2016 · 3 comments
Closed

Comments

@hoitsang
Copy link

Hello... looks like the plugin is having problem to parse a list respond.

client inteface: runner
target: noused
function: manage.present

from jenkins log:

Sending JSON: [{"client":"runner","mods":"","tgt":"notused","expr_form":"list","fun":"manage.present"}]
Jul 29, 2016 1:40:45 PM FINE com.waytta.saltstack
Received response: [["minion1","minion2","salt"]]

Errors:

Started by user admin
Building in workspace /var/lib/jenkins/workspace/_pull_minion_list_
ERROR: Build step failed with exception
net.sf.json.JSONException: 'object' is an array. Use JSONArray instead
    at net.sf.json.JSONObject.fromObject(JSONObject.java:167)
    at net.sf.json.JSONObject.fromObject(JSONObject.java:132)
    at com.waytta.Utils.validateFunctionCall(Utils.java:151)
    at com.waytta.SaltAPIBuilder.perform(SaltAPIBuilder.java:378)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1720)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)
Build step 'Send a message to Salt API' marked build as failure
Finished: FAILURE
@mchugh19
Copy link

Well, bummer. Most API results are returned in a different format which is what the plugin looks for. So in this case, it is choking on the result as it's a bit terse. Right now, I'm not sure what the best path forward is. I'll file an upstream bug report, but we're unlikely to get a API response normalization in the near future.

@mchugh19
Copy link

Just added a bit to master branch to support this case.

@mchugh19
Copy link

Released 2.0

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

2 participants