Skip to content

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

Closed

Description

@hoitsang

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

Activity

  1. mchugh19 commented on Oct 17, 2016

    @mchugh19

    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.

  2. mchugh19 commented on Nov 22, 2016

    @mchugh19

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

  3. mchugh19 commented on Feb 11, 2017

    @mchugh19

    Released 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions