ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject [23/50] [abbrv] ambari git commit: AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)
Date Thu, 08 Jun 2017 19:22:37 GMT
AMBARI-21182. Agent Host Disk Usage Alert Hardcodes the Stack Directory (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/119d2624
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/119d2624
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/119d2624

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 119d2624f96d66c9a4d5d559ca436de73adae444
Parents: 4dba161
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Jun 6 13:57:52 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Jun 6 13:57:52 2017 +0300

----------------------------------------------------------------------
 .../resources/host_scripts/alert_disk_space.py  | 22 +++++++-------------
 1 file changed, 8 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/119d2624/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
index d2b4f36..4c5834f 100644
--- a/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
+++ b/ambari-server/src/main/resources/host_scripts/alert_disk_space.py
@@ -36,18 +36,14 @@ MIN_FREE_SPACE_DEFAULT = 5000000000L
 PERCENT_USED_WARNING_DEFAULT = 50
 PERCENT_USED_CRITICAL_DEFAULT = 80
 
-# the location where HDP installs components when using HDP 2.2+
-STACK_HOME_DIR = "/usr/hdp"
-
-# the location where HDP installs components when using HDP 2.0 to 2.1
-STACK_HOME_LEGACY_DIR = "/usr/lib"
+STACK_ROOT = '{{cluster-env/stack_root}}'
 
 def get_tokens():
   """
   Returns a tuple of tokens in the format {{site/property}} that will be used
   to build the dictionary passed into execute
   """
-  return None
+  return (STACK_ROOT, )
 
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
@@ -65,15 +61,13 @@ def execute(configurations={}, parameters={}, host_name=None):
   host_name (string): the name of this host where the alert is running
   """
 
-  # determine the location of HDP home
-  stack_home = None
-  if os.path.isdir(STACK_HOME_DIR):
-    stack_home = STACK_HOME_DIR
-  elif os.path.isdir(STACK_HOME_LEGACY_DIR):
-    stack_home = STACK_HOME_LEGACY_DIR
+  if configurations is None:
+    return (('UNKNOWN', ['There were no configurations supplied to the script.']))
+
+  if not STACK_ROOT in configurations:
+    return (('STACK_ROOT', ['cluster-env/stack_root is not specified']))
 
-  # if stack home was found, use it; otherwise default to None
-  path = stack_home if stack_home is not None else None
+  path = configurations[STACK_ROOT]
 
   try:
     disk_usage = _get_disk_usage(path)


Mime
View raw message