You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Swapan Shridhar (JIRA)" <ji...@apache.org> on 2017/11/22 08:24:00 UTC

[jira] [Updated] (AMBARI-22498) Remove trailing lines (if any) from llapstatus command before converting the o/p to JSON.

     [ https://issues.apache.org/jira/browse/AMBARI-22498?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Swapan Shridhar updated AMBARI-22498:
-------------------------------------
    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.

{code:title=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
{code}




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

  was:
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.

{code:title=EXAMPLE of extra lines at beginning and end sandwiching the JSOn structure}
######## 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
{code}




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


> Remove trailing lines (if any) from llapstatus command before converting the o/p to JSON.
> -----------------------------------------------------------------------------------------
>
>                 Key: AMBARI-22498
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22498
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.5.0
>            Reporter: Swapan Shridhar
>            Assignee: Swapan Shridhar
>             Fix For: 2.6.1
>
>
> 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.
> {code:title=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
> {code}
> Fix: Added code to remove the trailing lines as well. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)