You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@ambari.apache.org by Swapan Shridhar <ss...@hortonworks.com> on 2017/11/22 08:31:26 UTC

Review Request 64024: AMBARI-22498. Remove trailing lines (if any) from llapstatus command before converting the o/p to JSON.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/64024/
-----------------------------------------------------------

Review request for Ambari, Jayush Luniya and Madhuvanthi Radhakrishnan.


Bugs: AMBARI-22498
    https://issues.apache.org/jira/browse/AMBARI-22498


Repository: ambari


Description
-------

**BACKGROUND:**

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


Diffs
-----

  ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py 57cbcd0 
  ambari-server/src/test/python/stacks/2.5/HIVE/running_withMOTDmsg_andTrailingMsg.txt PRE-CREATION 
  ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py cf79ec7 


Diff: https://reviews.apache.org/r/64024/diff/1/


Testing
-------

- UT added having begginning and end extra lines. Passes.
- Tested on live cluster with no begginning and trailing message.


Thanks,

Swapan Shridhar


Re: Review Request 64024: AMBARI-22498. Remove trailing lines (if any) from llapstatus command before converting the o/p to JSON.

Posted by Madhuvanthi Radhakrishnan <mr...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/64024/#review191751
-----------------------------------------------------------


Ship it!




Ship It!

- Madhuvanthi Radhakrishnan


On Nov. 22, 2017, 8:31 a.m., Swapan Shridhar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/64024/
> -----------------------------------------------------------
> 
> (Updated Nov. 22, 2017, 8:31 a.m.)
> 
> 
> Review request for Ambari, Jayush Luniya and Madhuvanthi Radhakrishnan.
> 
> 
> Bugs: AMBARI-22498
>     https://issues.apache.org/jira/browse/AMBARI-22498
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> **BACKGROUND:**
> 
> - 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.
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py 57cbcd0 
>   ambari-server/src/test/python/stacks/2.5/HIVE/running_withMOTDmsg_andTrailingMsg.txt PRE-CREATION 
>   ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py cf79ec7 
> 
> 
> Diff: https://reviews.apache.org/r/64024/diff/1/
> 
> 
> Testing
> -------
> 
> - UT added having begginning and end extra lines. Passes.
> - Tested on live cluster with no begginning and trailing message.
> 
> 
> Thanks,
> 
> Swapan Shridhar
> 
>