Uploaded image for project: 'Ambari'
  1. Ambari
  2. AMBARI-22498

Remove trailing lines (if any) from llapstatus command before converting the o/p to JSON.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5.0
    • 2.6.1
    • ambari-server
    • None

    Description

      Existing code was removing extra lines from the beginning which may come because of MOTD.
      Similar issue can happen if there are extra lines as the end, which if passed in for converting to JSON will fail.

      EXAMPLE of extra lines at beginning and end sandwiching the JSOn structure which needs to be parsed
      ######## Hortonworks #############
      This is MOTD message, added for testing in qe infra
      {
        "amInfo" : {
          "appName" : "llap",
          "appType" : "org-apache-slider",
          "appId" : "application_1455662455106_10882",
          "containerId" : "container_e14_1455662455106_10882_01_000001",
          "hostname" : "HOST_REPLACED",
          "amWebUrl" : "http://HOST_REPLACED:1025/"
        },
        "state" : "RUNNING_ALL",
        "originalConfigurationPath" : "hdfs://HOST_REPLACED:8020/user/USER_REPLACED/.slider/cluster/llap/snapshot",
        "generatedConfigurationPath" : "hdfs://HOST_REPLACED:8020/user/USER_REPLACED/.slider/cluster/llap/generated",
        "desiredInstances" : 3,
        "liveInstances" : 3,
        "appStartTime" : 1459625802169,
        "llapInstances" : [ {
          "hostname" : "HOST_REPLACED",
          "containerId" : "container_e14_1455662455106_10882_01_000003",
          "statusUrl" : "http://HOST_REPLACED:15002/status",
          "webUrl" : "http://HOST_REPLACED:15002",
          "rpcPort" : 15001,
          "mgmtPort" : 15004,
          "shufflePort" : 15551
        }, {
          "hostname" : "HOST_REPLACED",
          "containerId" : "container_e14_1455662455106_10882_01_000002",
          "statusUrl" : "http://HOST_REPLACED:15002/status",
          "webUrl" : "http://HOST_REPLACED:15002",
          "rpcPort" : 15001,
          "mgmtPort" : 15004,
          "shufflePort" : 15551
        }, {
          "hostname" : "HOST_REPLACED",
          "containerId" : "container_e14_1455662455106_10882_01_000004",
          "statusUrl" : "http://HOST_REPLACED:15002/status",
          "webUrl" : "http://HOST_REPLACED:15002",
          "rpcPort" : 15001,
          "mgmtPort" : 15004,
          "shufflePort" : 15551
        } ]
      }
      
      # THIS IS A DUMMY TRAILING MESSAGE 1
      # THIS IS A DUMMY TRAILING MESSAGE 2
      

      Fix: Added code to remove the trailing lines as well.

      Attachments

        1. AMBARI-22498.patch
          6 kB
          Swapan Shridhar

        Issue Links

          Activity

            People

              swapanshridhar Swapan Shridhar
              swapanshridhar Swapan Shridhar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: