You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2016/06/23 03:30:53 UTC
[2/2] ambari git commit: AMBARI-17384. Remove '/usr/hdp' hardcoding
from HIVE's alert_llap_app_status.py and KNOX's upgrade.py
AMBARI-17384. Remove '/usr/hdp' hardcoding from HIVE's alert_llap_app_status.py and KNOX's upgrade.py
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a6160b4e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a6160b4e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a6160b4e
Branch: refs/heads/trunk
Commit: a6160b4e8897eee335b30706d15a297ffa8b298c
Parents: 193baea
Author: Swapan Shridhar <ss...@hortonworks.com>
Authored: Wed Jun 22 15:34:39 2016 -0700
Committer: Swapan Shridhar <ss...@hortonworks.com>
Committed: Wed Jun 22 20:30:24 2016 -0700
----------------------------------------------------------------------
.../0.12.0.2.0/package/alerts/alert_llap_app_status.py | 11 ++++++-----
.../package/scripts/hive_server_interactive.py | 5 +++--
.../KNOX/0.5.0.2.2/package/scripts/upgrade.py | 6 +++++-
3 files changed, 14 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/a6160b4e/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_llap_app_status.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_llap_app_status.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_llap_app_status.py
index 33bf139..c3aab6f 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_llap_app_status.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/alerts/alert_llap_app_status.py
@@ -32,7 +32,7 @@ from resource_management.core import shell
from resource_management.core.resources import Execute
from resource_management.core import global_lock
from resource_management.core.exceptions import Fail
-
+from resource_management.libraries.script.script import Script
OK_MESSAGE = "The application reported a '{0}' state in {1:.3f}s"
MESSAGE_WITH_STATE_AND_INSTANCES = "The application reported a '{0}' state in {1:.3f}s. [Live: {2}, Desired: {3}]"
@@ -59,7 +59,7 @@ HIVE_USER_KEY = '{{hive-env/hive_user}}'
HIVE_USER_DEFAULT = 'default.smoke.user'
STACK_ROOT = '{{cluster-env/stack_root}}'
-STACK_ROOT_DEFAULT = "/usr/hdp"
+STACK_ROOT_DEFAULT = Script.get_stack_root()
LLAP_APP_NAME_KEY = '{{hive-interactive-env/llap_app_name}}'
LLAP_APP_NAME_DEFAULT = 'llap0'
@@ -160,7 +160,7 @@ def execute(configurations={}, parameters={}, host_name=None):
if STACK_ROOT in configurations:
llap_status_cmd = configurations[STACK_ROOT] + format("/current/hive-server2-hive2/bin/hive --service llapstatus --name {llap_app_name} -findAppTimeout {LLAP_APP_STATUS_CMD_TIMEOUT}")
else:
- llap_status_cmd = format("/usr/hdp/current/hive-server2-hive2/bin/hive --service llapstatus --name {llap_app_name}")
+ llap_status_cmd = STACK_ROOT_DEFAULT + format("/current/hive-server2-hive2/bin/hive --service llapstatus --name {llap_app_name}")
code, output, error = shell.checked_call(llap_status_cmd, user=hive_user, stderr=subprocess.PIPE,
timeout=check_command_timeout,
@@ -289,8 +289,9 @@ def make_valid_json(output):
if marker_idx is None:
raise Fail("Couldn't validate the received output for JSON parsing.")
else:
- del splits[0:marker_idx]
+ if marker_idx != 0:
+ del splits[0:marker_idx]
scanned_output = '\n'.join(splits)
llap_app_info = json.loads(scanned_output)
- return llap_app_info
+ return llap_app_info
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/a6160b4e/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
index 2da613f..e892509 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_server_interactive.py
@@ -368,8 +368,9 @@ class HiveServerInteractiveDefault(HiveServerInteractive):
if marker_idx is None:
raise Fail("Couldn't validate the received output for JSON parsing.")
else:
- del splits[0:marker_idx]
- Logger.info("Removed lines: '1-{0}' from the received 'llapstatus' output to make it valid for JSON parsing.".format(marker_idx))
+ if marker_idx != 0:
+ del splits[0:marker_idx]
+ Logger.info("Removed lines: '1-{0}' from the received 'llapstatus' output to make it valid for JSON parsing.".format(marker_idx))
scanned_output = '\n'.join(splits)
llap_app_info = json.loads(scanned_output)
http://git-wip-us.apache.org/repos/asf/ambari/blob/a6160b4e/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
index 8c71260..917f340 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/upgrade.py
@@ -28,10 +28,12 @@ from resource_management.libraries.functions import tar_archive
from resource_management.libraries.functions import format
from resource_management.libraries.functions.stack_features import check_stack_feature
from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.script.script import Script
BACKUP_TEMP_DIR = "knox-upgrade-backup"
BACKUP_DATA_ARCHIVE = "knox-data-backup.tar"
+STACK_ROOT_DEFAULT = Script.get_stack_root()
def backup_data():
"""
@@ -65,6 +67,8 @@ def backup_data():
def seed_current_data_directory():
"""
+ HDP stack example:
+
Knox uses "versioned" data directories in some stacks:
/usr/hdp/2.2.0.0-1234/knox/data -> /var/lib/knox/data
/usr/hdp/2.3.0.0-4567/knox/data -> /var/lib/knox/data-2.3.0.0-4567
@@ -106,7 +110,7 @@ def _get_directory_mappings_during_upgrade():
# the data directory is always a symlink to the "correct" data directory in /var/lib/knox
# such as /var/lib/knox/data or /var/lib/knox/data-2.4.0.0-1234
- knox_data_dir = '/usr/hdp/current/knox-server/data'
+ knox_data_dir = STACK_ROOT_DEFAULT + '/current/knox-server/data'
directories = { knox_data_dir: BACKUP_DATA_ARCHIVE }