ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlun...@apache.org
Subject ambari git commit: AMBARI-17231: Oozie Alert Fails Because Of Params Module (jluniya)
Date Wed, 15 Jun 2016 19:55:51 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 515e1e992 -> 1c8b3dec3


AMBARI-17231: Oozie Alert Fails Because Of Params Module (jluniya)


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

Branch: refs/heads/trunk
Commit: 1c8b3dec30e5058ae9bebf4947b37c555920035b
Parents: 515e1e9
Author: Jayush Luniya <jluniya@hortonworks.com>
Authored: Wed Jun 15 12:55:46 2016 -0700
Committer: Jayush Luniya <jluniya@hortonworks.com>
Committed: Wed Jun 15 12:55:46 2016 -0700

----------------------------------------------------------------------
 .../package/alerts/alert_check_oozie_server.py  | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1c8b3dec/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/alerts/alert_check_oozie_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/alerts/alert_check_oozie_server.py
b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/alerts/alert_check_oozie_server.py
index 381c43c..0e9fe74 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/alerts/alert_check_oozie_server.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/alerts/alert_check_oozie_server.py
@@ -30,10 +30,7 @@ from ambari_commons.os_check import OSConst, OSCheck
 from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl
 from urlparse import urlparse
 
-import params
-
-stack_root = params.stack_root
-
+STACK_ROOT_PATTERN = "{{ stack_root }}"
 RESULT_CODE_OK = 'OK'
 RESULT_CODE_CRITICAL = 'CRITICAL'
 RESULT_CODE_UNKNOWN = 'UNKNOWN'
@@ -49,7 +46,7 @@ KERBEROS_EXECUTABLE_SEARCH_PATHS_KEY = '{{kerberos-env/executable_search_paths}}
 OOZIE_URL_KEY = '{{oozie-site/oozie.base.url}}'
 SECURITY_ENABLED = '{{cluster-env/security_enabled}}'
 OOZIE_USER = '{{oozie-env/oozie_user}}'
-OOZIE_CONF_DIR = format("{stack_root}/current/oozie-server/conf")
+OOZIE_CONF_DIR = "{0}/current/oozie-server/conf".format(STACK_ROOT_PATTERN)
 OOZIE_CONF_DIR_LEGACY = '/etc/oozie/conf'
 OOZIE_HTTPS_PORT = '{{oozie-site/oozie.https.port}}'
 OOZIE_ENV_CONTENT = '{{oozie-env/content}}'
@@ -69,6 +66,9 @@ USER_PRINCIPAL_DEFAULT = 'oozie@EXAMPLE.COM'
 # default user
 USER_DEFAULT = 'oozie'
 
+STACK_ROOT_KEY = '{{cluster-env/stack_root}}'
+STACK_ROOT_DEFAULT = '/usr/hdp'
+
 class KerberosPropertiesNotFound(Exception): pass
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
@@ -86,7 +86,7 @@ def get_tokens():
   to build the dictionary passed into execute
   """
   return (OOZIE_URL_KEY, USER_PRINCIPAL_KEY, SECURITY_ENABLED, USER_KEYTAB_KEY, KERBEROS_EXECUTABLE_SEARCH_PATHS_KEY,
-          USER_KEY, OOZIE_HTTPS_PORT, OOZIE_ENV_CONTENT)
+          USER_KEY, OOZIE_HTTPS_PORT, OOZIE_ENV_CONTENT, STACK_ROOT_KEY)
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
 def get_check_command(oozie_url, host_name, configurations):
@@ -156,10 +156,15 @@ def get_check_command(oozie_url, host_name, configurations, parameters,
only_kin
     finally:
       kinit_lock.release()
 
+  # Configure stack root
+  stack_root = STACK_ROOT_DEFAULT
+  if STACK_ROOT_KEY in configurations:
+    stack_root = configurations[STACK_ROOT_KEY].lower()
+
   # oozie configuration directory using a symlink
-  oozie_config_directory = OOZIE_CONF_DIR_LEGACY
-  if os.path.exists(OOZIE_CONF_DIR):
-    oozie_config_directory = OOZIE_CONF_DIR
+  oozie_config_directory = OOZIE_CONF_DIR.replace(STACK_ROOT_PATTERN, stack_root)
+  if not os.path.exists(oozie_config_directory):
+    oozie_config_directory = OOZIE_CONF_DIR_LEGACY
 
   command = "source {0}/oozie-env.sh ; oozie admin -oozie {1} -status".format(
     oozie_config_directory, oozie_url)


Mime
View raw message