Repository: ambari
Updated Branches:
  refs/heads/trunk aff27a73e -> c76723638


AMBARI-17743. Storm service check failed during Express Upgrade due to Nimbus 
going down after restart with CNF IClusterReporter.  Part 2 (ncole)


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

Branch: refs/heads/trunk
Commit: c767236380dc0cd1225297d14dda16045c5dc6aa
Parents: aff27a7
Author: Nate Cole <[email protected]>
Authored: Sat Jul 16 15:07:36 2016 -0400
Committer: Nate Cole <[email protected]>
Committed: Sat Jul 16 15:07:36 2016 -0400

----------------------------------------------------------------------
 .../STORM/0.9.1/package/scripts/ui_server.py    |  6 +--
 .../stacks/2.1/STORM/test_storm_ui_server.py    | 43 ++++++++++++++++++++
 2 files changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7672363/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
index 427b8ff..63d5731 100644
--- 
a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
+++ 
b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py
@@ -93,10 +93,10 @@ class UiServerDefault(UiServer):
     # On old HDP 2.1 versions, this symlink may also exist and break EU to 
newer versions
     Link("/usr/lib/storm/lib/ambari-metrics-storm-sink.jar", action="delete")
 
-    if params.availableServices.has_key("STORM") and 
params.availableServices.get("STORM").startswith("0"):
-      sink_jar = params.metric_collector_legacy_sink_jar
-    else:
+    if check_stack_feature(StackFeature.STORM_METRICS_APACHE_CLASSES, 
params.version_for_stack_feature_checks):
       sink_jar = params.metric_collector_sink_jar
+    else:
+      sink_jar = params.metric_collector_legacy_sink_jar
 
     Execute(format("{sudo} ln -s {sink_jar} 
{storm_lib_dir}/ambari-metrics-storm-sink.jar"),
             not_if=format("ls {storm_lib_dir}/ambari-metrics-storm-sink.jar"),

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7672363/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py 
b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
index 689eedc..d6497ed 100644
--- a/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
+++ b/ambari-server/src/test/python/stacks/2.1/STORM/test_storm_ui_server.py
@@ -73,6 +73,49 @@ class TestStormUiServer(TestStormBase):
     )
     self.assertNoMoreResources()
 
+  def test_start_with_apache_classes(self):
+    config_file = 
self.get_src_folder()+"/test/python/stacks/2.1/configs/default.json"
+    with open(config_file, "r") as f:
+      json_content = json.load(f)
+    version = '2.5.0.0-1234'
+    json_content['commandParams']['version'] = version
+
+
+
+    self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + 
"/scripts/ui_server.py",
+                       classname = "UiServer",
+                       command = "start",
+                       config_dict=json_content,
+                       stack_version = self.STACK_VERSION,
+                       target = RMFTestCase.TARGET_COMMON_SERVICES
+    )
+
+    self.assert_configure_default()
+
+    self.assertResourceCalled('Link', 
'/usr/lib/storm/lib//ambari-metrics-storm-sink.jar',
+                              action=['delete'],
+                              )
+
+    self.assertResourceCalled('Link', 
'/usr/lib/storm/lib/ambari-metrics-storm-sink.jar',
+                              action=['delete'],
+                              )
+
+    self.assertResourceCalled('Execute', 'ambari-sudo.sh ln -s 
/usr/lib/storm/lib/ambari-metrics-storm-sink-with-common-*.jar '
+                                         
'/usr/lib/storm/lib//ambari-metrics-storm-sink.jar',
+                              not_if=format("ls 
/usr/lib/storm/lib//ambari-metrics-storm-sink.jar"),
+                              only_if=format("ls 
/usr/lib/storm/lib/ambari-metrics-storm-sink-with-common-*.jar")
+                              )
+    self.assertResourceCalled('Execute', 'source /etc/storm/conf/storm-env.sh 
; export PATH=$JAVA_HOME/bin:$PATH ; storm ui > /var/log/storm/ui.out 2>&1 &\n 
echo $! > /var/run/storm/ui.pid',
+        path = ['/usr/bin'],
+        user = 'storm',
+        not_if = "ambari-sudo.sh su storm -l -s /bin/bash -c 
'[RMF_EXPORT_PLACEHOLDER]ls /var/run/storm/ui.pid >/dev/null 2>&1 && ps -p `cat 
/var/run/storm/ui.pid` >/dev/null 2>&1'",
+    )
+    self.assertResourceCalled('File', '/var/run/storm/ui.pid',
+        owner = 'storm',
+        group = 'hadoop',
+    )
+    self.assertNoMoreResources()
+
   @patch("os.path.exists")
   def test_stop_default(self, path_exists_mock):
     # Bool for the pid file

Reply via email to