Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 8cacf79b1 -> d0efcd8d2
  refs/heads/trunk ab9a67ad7 -> 9bde38785


AMBARI-18022. STORM service check failure while EU due to CNF StormAtlasHook 
(dgrinenko via dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 9bde387854976c76ec93cace59039e34c470b2c8
Parents: ab9a67a
Author: Lisnichenko Dmitro <[email protected]>
Authored: Thu Aug 4 19:44:47 2016 +0300
Committer: Lisnichenko Dmitro <[email protected]>
Committed: Thu Aug 4 19:44:47 2016 +0300

----------------------------------------------------------------------
 .../services/STORM/configuration/storm-site.xml | 16 +++++++++
 .../stacks/HDP/2.3/services/stack_advisor.py    | 34 +++++++++-----------
 .../stacks/2.3/common/test_stack_advisor.py     |  7 ++++
 3 files changed, 38 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9bde3878/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
index f3bbce8..62d0fb2 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/STORM/configuration/storm-site.xml
@@ -54,4 +54,20 @@
     </value-attributes>
     <on-ambari-upgrade add="true"/>
   </property>
+
+  <!--
+   Property storm.topology.submission.notifier.plugin.class definition is 
required only when Atlas service is installed.
+   To remove this property, we need to create dependency with Atlas service.
+   -->
+  <property>
+    <name>storm.topology.submission.notifier.plugin.class</name>
+    <value> </value>
+    <depends-on>
+      <property>
+        <type>application-properties</type>
+        <name>atlas.authentication.method</name>
+      </property>
+    </depends-on>
+    <on-ambari-upgrade add="true"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9bde3878/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py 
b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
index eb691eb..9f2caf9 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/services/stack_advisor.py
@@ -714,31 +714,27 @@ class HDP23StackAdvisor(HDP22StackAdvisor):
     if "storm-site" in services["configurations"]:
       # atlas
       notifier_plugin_property = 
"storm.topology.submission.notifier.plugin.class"
-      if notifier_plugin_property in 
services["configurations"]["storm-site"]["properties"]:
+      if notifier_plugin_property in 
services["configurations"]["storm-site"]["properties"] and \
+         
services["configurations"]["storm-site"]["properties"][notifier_plugin_property]
 is not None:
+
         notifier_plugin_value = 
services["configurations"]["storm-site"]["properties"][notifier_plugin_property]
-        if notifier_plugin_value is None:
-          notifier_plugin_value = " "
       else:
         notifier_plugin_value = " "
 
-      include_atlas = "ATLAS" in servicesList
+      atlas_is_present = "ATLAS" in servicesList
       atlas_hook_class = "org.apache.atlas.storm.hook.StormAtlasHook"
-      if include_atlas and atlas_hook_class not in notifier_plugin_value:
-        if notifier_plugin_value == " ":
-          notifier_plugin_value = atlas_hook_class
-        else:
-          notifier_plugin_value = notifier_plugin_value + "," + 
atlas_hook_class
-      if not include_atlas and atlas_hook_class in notifier_plugin_value:
-        application_classes = []
-        for application_class in notifier_plugin_value.split(","):
-          if application_class != atlas_hook_class and application_class != " 
":
-            application_classes.append(application_class)
-        if application_classes:
-          notifier_plugin_value = ",".join(application_classes)
-        else:
-          notifier_plugin_value = " "
+      atlas_hook_is_set = atlas_hook_class in notifier_plugin_value
+
+      if atlas_is_present and not atlas_hook_is_set:
+        notifier_plugin_value = atlas_hook_class if notifier_plugin_value == " 
" else ",".join([notifier_plugin_value, atlas_hook_class])
+
+      if not atlas_is_present and atlas_hook_is_set:
+        application_classes = [item for item in 
notifier_plugin_value.split(",") if item != atlas_hook_class and item != " "]
+        notifier_plugin_value = ",".join(application_classes) if 
application_classes else " "
+
+      if notifier_plugin_value != " " or \
+         (not atlas_is_present and atlas_hook_is_set):
 
-      if notifier_plugin_value != " ":
         putStormStartupProperty(notifier_plugin_property, 
notifier_plugin_value)
 
   def recommendFalconConfigurations(self, configurations, clusterData, 
services, hosts):

http://git-wip-us.apache.org/repos/asf/ambari/blob/9bde3878/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py 
b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
index f243f15..1af87e4 100644
--- a/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.3/common/test_stack_advisor.py
@@ -1776,6 +1776,13 @@ class TestHDP23StackAdvisor(TestCase):
     self.stackAdvisor.recommendStormConfigurations(configurations, 
clusterData, services, hosts)
     self.assertEquals(configurations, expected)
 
+    services["services"] = []
+    
services["configurations"]["storm-site"]["properties"]["storm.topology.submission.notifier.plugin.class"]
 = "org.apache.atlas.storm.hook.StormAtlasHook"
+    
expected["storm-site"]["properties"]["storm.topology.submission.notifier.plugin.class"]
 = " "
+    self.stackAdvisor.recommendStormConfigurations(configurations, 
clusterData, services, hosts)
+    self.assertEquals(configurations, expected)
+
+
   def test_recommendFalconConfigurations(self):
     self.maxDiff = None
     configurations = {

Reply via email to