ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From oleew...@apache.org
Subject ambari git commit: AMBARI-17180. Fix HA enabled logic in the alerts (Miklos Gergely via oleewere)
Date Fri, 17 Jun 2016 14:51:57 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a6e2d9203 -> 5bd5e2da8


AMBARI-17180. Fix HA enabled logic in the alerts (Miklos Gergely via oleewere)


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

Branch: refs/heads/trunk
Commit: 5bd5e2da8b62a83c1275e0b7e484edd78577a34e
Parents: a6e2d92
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Fri Jun 17 16:42:06 2016 +0200
Committer: oleewere <oleewere@gmail.com>
Committed: Fri Jun 17 16:51:13 2016 +0200

----------------------------------------------------------------------
 .../python/ambari_agent/alerts/base_alert.py    | 33 ++++++++++++--------
 1 file changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5bd5e2da/ambari-agent/src/main/python/ambari_agent/alerts/base_alert.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/base_alert.py b/ambari-agent/src/main/python/ambari_agent/alerts/base_alert.py
index 6c8ca5a..7f3b2a5 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/base_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/base_alert.py
@@ -395,22 +395,29 @@ class BaseAlert(object):
     ha_http_pattern = alert_uri_lookup_keys.ha_http_pattern
     ha_https_pattern = alert_uri_lookup_keys.ha_https_pattern
 
-    # at least one of these keys is needed
-    if ha_nameservice is None and ha_alias_key is None:
+    # if HA alias key is not defined then it's not HA environment
+    if ha_alias_key is None:
       return None
 
-    # convert dfs.ha.namenodes.{{ha-nameservice}} into
-    # dfs.ha.namenodes.c1ha
-    if ha_nameservice is not None:
+    if alert_uri_lookup_keys.ha_nameservice is not None:
+      # if there is a HA nameservice defined, but it can not be evaluated then it's not HA
environment
+      if ha_nameservice is None:
+        return None
+      
+      # convert dfs.ha.namenodes.{{ha-nameservice}} into dfs.ha.namenodes.c1ha
       ha_alias_key = ha_alias_key.replace(self.HA_NAMESERVICE_PARAM, ha_nameservice)
-
-    # grab the alias value which should be like nn1, nn2
-    ha_nameservice_alias = self._get_configuration_value(ha_alias_key)
-    if ha_nameservice_alias is None:
-      logger.warning("[Alert][{0}] HA nameservice value is present but there are no aliases
for {1}".format(
-        self.get_name(), ha_alias_key))
-
-      return None
+      ha_nameservice_alias = self._get_configuration_value(ha_alias_key)
+      
+      if ha_nameservice_alias is None:
+        logger.warning("[Alert][{0}] HA nameservice value is present but there are no aliases
for {1}".format(
+          self.get_name(), ha_alias_key))
+        return None
+    else:
+      ha_nameservice_alias = self._get_configuration_value(ha_alias_key)
+      
+      # if HA nameservice is not defined then the fact that the HA alias_key could not be
evaluated shows that it's not HA environment
+      if ha_nameservice_alias is None:
+        return None
 
     # determine which pattern to use (http or https)
     ha_pattern = ha_http_pattern


Mime
View raw message