Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-4460

jboss-cli.sh doesn't return json when the output command is 'failed'

XMLWordPrintable

    • Hide

      Step 1. Restart a JBoss server or host;

      Step 2. During the upstart of the server/host, run the command:

      /opt/jboss/jboss7_2/jboss-eap-7.2/bin/jboss-cli.sh --connect --controller=localhost:9990 --command="/host=*/server=*/deployment=*/:read-resource(recursive=false,include-runtime=true)" --output-json
      

      or equivalent for your environment. Notice that the response will NOT be in JSON-format, it will be in the DMR format.

      The following output was generated following the above steps:

      [tosorio@localhost bin]$ ./jboss-cli.sh --connect --controller=localhost:9990 --command="/host=*/server='*'/deployment=*/:read-resource(recursive=false,include-runtime=true)" --output-json
      {
          "outcome" => "failed",
          "result" => [{
              "address" => [
                  ("host" => "master"),
                  ("server" => "server-two"),
                  ("deployment" => "fabrica.war")
              ],
              "outcome" => "failed",
              "result" => {
                  "content" => [{
                      "hash" => bytes {
                          0x73, 0xa2, 0x23, 0xaf, 0x5b, 0xb3, 0x3f, 0xc0,
                          0xaf, 0x84, 0x56, 0x33, 0x99, 0xfb, 0x6c, 0xa6,
                          0xd1, 0xf1, 0x58, 0x40
                      },
                      "archive" => undefined
                 (...)
          "rolled-back" => true
      


      However, when the server is completely restarted, the json ouput works properly:

      Show
      Step 1. Restart a JBoss server or host; Step 2. During the upstart of the server/host, run the command: /opt/jboss/jboss7_2/jboss-eap-7.2/bin/jboss-cli.sh --connect --controller=localhost:9990 --command="/host=*/server=*/deployment=*/:read-resource(recursive=false,include-runtime=true)" --output-json or equivalent for your environment. Notice that the response will NOT be in JSON-format, it will be in the DMR format. The following output was generated following the above steps: [tosorio@localhost bin]$ ./jboss-cli.sh --connect --controller=localhost:9990 --command="/host=*/server='*'/deployment=*/:read-resource(recursive=false,include-runtime=true)" --output-json { "outcome" => "failed", "result" => [{ "address" => [ ("host" => "master"), ("server" => "server-two"), ("deployment" => "fabrica.war") ], "outcome" => "failed", "result" => { "content" => [{ "hash" => bytes { 0x73, 0xa2, 0x23, 0xaf, 0x5b, 0xb3, 0x3f, 0xc0, 0xaf, 0x84, 0x56, 0x33, 0x99, 0xfb, 0x6c, 0xa6, 0xd1, 0xf1, 0x58, 0x40 }, "archive" => undefined (...) "rolled-back" => true — However, when the server is completely restarted, the json ouput works properly:

      The CLI returns a JSON output just when the CLI command got 'success'. In case of the output 'failed' the output is only DMR syntax.

      The following command was used in the tests:

      $JBOSS_HOME/bin/boss-cli.sh --connect --controller=localhost:9990 --command="/host=*/server=*/deployment=*/:read-resource(recursive=false,include-runtime=true)" --output-json
      

              rhn-support-iweiss Ingo Weiss
              rhn-support-iweiss Ingo Weiss
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: