ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject ambari git commit: AMBARI-12128. Falcon Server Web UI alert fails when Kerberos is enabled (rlevas)
Date Wed, 24 Jun 2015 19:05:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 e2203293c -> b665fb511


AMBARI-12128. Falcon Server Web UI alert fails when Kerberos is enabled (rlevas)


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

Branch: refs/heads/branch-2.1
Commit: b665fb51153e4358f0bae9ee2dfd70789a238805
Parents: e220329
Author: Robert Levas <rlevas@hortonworks.com>
Authored: Wed Jun 24 15:05:09 2015 -0400
Committer: Robert Levas <rlevas@hortonworks.com>
Committed: Wed Jun 24 15:05:09 2015 -0400

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/alerts/base_alert.py  |  5 +----
 .../src/test/python/ambari_agent/TestAlerts.py         | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b665fb51/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 47e15f0..9151796 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
@@ -213,11 +213,8 @@ class BaseAlert(object):
       if isinstance(value, dict):
         return value
 
-      # foo-site/bar -> r"{{(foo-site/bar)}}
-      replacement_match_regex = r"{{(%s)}}" % placeholder_key
-
       # {{foo-bar/baz}}/whatever -> http://server/whatever
-      resolved_key = re.sub(replacement_match_regex, value, resolved_key)
+      resolved_key = resolved_key.replace("{{%s}}" % placeholder_key, value)
 
     return resolved_key
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b665fb51/ambari-agent/src/test/python/ambari_agent/TestAlerts.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestAlerts.py b/ambari-agent/src/test/python/ambari_agent/TestAlerts.py
index 151c13b..4570842 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestAlerts.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestAlerts.py
@@ -977,7 +977,13 @@ class TestAlerts(TestCase):
     """
     configuration = { 'foo-site' :
       { 'foo-key1' : 'value1',
-        'foo-key2' : 'value2'
+        'foo-key2' : 'value2',
+        'special-character-*' : 'asterisk',
+        'special-character-$' : 'dollar sign',
+        'special-character-%' : 'percent',
+        'special-character-#' : 'hash',
+        'special-character-!' : 'bang',
+        'special-character-&' : 'ampersand'
       }
     }
 
@@ -992,6 +998,11 @@ class TestAlerts(TestCase):
     self.assertEquals("constant", alert._get_configuration_value("constant"))
     self.assertEquals("value1", alert._get_configuration_value("{{foo-site/foo-key1}}"))
     self.assertEquals("value2", alert._get_configuration_value("{{foo-site/foo-key2}}"))
+    self.assertEquals("asterisk", alert._get_configuration_value("{{foo-site/special-character-*}}"))
+    self.assertEquals("dollar sign", alert._get_configuration_value("{{foo-site/special-character-$}}"))
+    self.assertEquals("hash", alert._get_configuration_value("{{foo-site/special-character-#}}"))
+    self.assertEquals("bang", alert._get_configuration_value("{{foo-site/special-character-!}}"))
+    self.assertEquals("ampersand", alert._get_configuration_value("{{foo-site/special-character-&}}"))
 
     # try a mix of parameter and constant
     self.assertEquals("http://value1/servlet", alert._get_configuration_value("http://{{foo-site/foo-key1}}/servlet"))


Mime
View raw message