You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/02/14 20:04:55 UTC

[2/2] git commit: AMBARI-4681. Rolling restart for Supervisors fails if component is in INSTALLED state (Arsen Babych via aonishuk)

AMBARI-4681. Rolling restart for Supervisors fails if component is in
INSTALLED state (Arsen Babych via aonishuk)


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

Branch: refs/heads/trunk
Commit: b59b258d243832ace399b0c8e2213ba38474dc79
Parents: f60a78f
Author: Andrew Onischuk <ao...@hortonworks.com>
Authored: Fri Feb 14 11:00:42 2014 -0800
Committer: Andrew Onischuk <ao...@hortonworks.com>
Committed: Fri Feb 14 11:00:42 2014 -0800

----------------------------------------------------------------------
 .../HDP/2.1.1/services/STORM/package/scripts/service.py  |  7 +++++--
 .../python/stacks/2.1.1/STORM/test_storm_drpc_server.py  | 10 ++++++++--
 .../stacks/2.1.1/STORM/test_storm_logviewer_server.py    | 10 ++++++++--
 .../test/python/stacks/2.1.1/STORM/test_storm_nimbus.py  | 10 ++++++++--
 .../stacks/2.1.1/STORM/test_storm_rest_api_service.py    | 11 +++++++++--
 .../python/stacks/2.1.1/STORM/test_storm_supervisor.py   | 11 +++++++++--
 .../python/stacks/2.1.1/STORM/test_storm_ui_server.py    | 11 +++++++++--
 7 files changed, 56 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/package/scripts/service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/package/scripts/service.py b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/package/scripts/service.py
index e12e39b..5661458 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/package/scripts/service.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.1.1/services/STORM/package/scripts/service.py
@@ -62,10 +62,13 @@ def service(
     )
 
   elif action == "stop":
+    process_dont_exist = format("! ({no_op_test})")
     cmd = format("kill `cat {pid_file}` >/dev/null 2>&1")
-    Execute(cmd)
+    Execute(cmd,
+            not_if=process_dont_exist
+    )
 
-    Execute(format("! ({no_op_test})"),
+    Execute(process_dont_exist,
             tries=5,
             try_sleep=3
     )

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_drpc_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_drpc_server.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_drpc_server.py
index 3d44d12..b66e859 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_drpc_server.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_drpc_server.py
@@ -64,12 +64,15 @@ class TestStormDrpcServer(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/drpc.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/drpc.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/drpc.pid >/dev/null 2>&1 && ps `cat /var/run/storm/drpc.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/drpc.pid >/dev/null 2>&1 && ps `cat /var/run/storm/drpc.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/drpc.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/drpc_server.py",
@@ -110,12 +113,15 @@ class TestStormDrpcServer(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/drpc.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/drpc.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/drpc.pid >/dev/null 2>&1 && ps `cat /var/run/storm/drpc.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/drpc.pid >/dev/null 2>&1 && ps `cat /var/run/storm/drpc.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/drpc.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_logviewer_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_logviewer_server.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_logviewer_server.py
index 74fcbda..3c42ada 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_logviewer_server.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_logviewer_server.py
@@ -64,12 +64,15 @@ class TestStormLogviewerServer(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/logviewer.pid >/dev/null 2>&1 && ps `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/logviewer.pid >/dev/null 2>&1 && ps `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/logviewer.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/logviewer_server.py",
@@ -110,12 +113,15 @@ class TestStormLogviewerServer(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/logviewer.pid >/dev/null 2>&1 && ps `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/logviewer.pid >/dev/null 2>&1 && ps `cat /var/run/storm/logviewer.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/logviewer.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_nimbus.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_nimbus.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_nimbus.py
index 2ac251d..75c0377 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_nimbus.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_nimbus.py
@@ -64,12 +64,15 @@ class TestStormNimbus(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/nimbus.pid >/dev/null 2>&1 && ps `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/nimbus.pid >/dev/null 2>&1 && ps `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/nimbus.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/nimbus.py",
@@ -110,12 +113,15 @@ class TestStormNimbus(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/nimbus.pid >/dev/null 2>&1 && ps `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/nimbus.pid >/dev/null 2>&1 && ps `cat /var/run/storm/nimbus.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/nimbus.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_rest_api_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_rest_api_service.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_rest_api_service.py
index a945f21..b7ec67c 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_rest_api_service.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_rest_api_service.py
@@ -64,12 +64,16 @@ class TestStormRestApi(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/restapi.pid` >/dev/null 2>&1')
+
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/restapi.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/restapi.pid >/dev/null 2>&1 && ps `cat /var/run/storm/restapi.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/restapi.pid >/dev/null 2>&1 && ps `cat /var/run/storm/restapi.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/restapi.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/rest_api.py",
@@ -110,12 +114,15 @@ class TestStormRestApi(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/restapi.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/restapi.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/restapi.pid >/dev/null 2>&1 && ps `cat /var/run/storm/restapi.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/restapi.pid >/dev/null 2>&1 && ps `cat /var/run/storm/restapi.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/restapi.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_supervisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_supervisor.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_supervisor.py
index 97502db..ca452cd 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_supervisor.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_supervisor.py
@@ -64,12 +64,16 @@ class TestStormSupervisor(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1')
+
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/supervisor.pid >/dev/null 2>&1 && ps `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/supervisor.pid >/dev/null 2>&1 && ps `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/supervisor.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/supervisor.py",
@@ -110,12 +114,15 @@ class TestStormSupervisor(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/supervisor.pid >/dev/null 2>&1 && ps `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/supervisor.pid >/dev/null 2>&1 && ps `cat /var/run/storm/supervisor.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/supervisor.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b59b258d/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_ui_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_ui_server.py b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_ui_server.py
index 93e8c04..2e8d775 100644
--- a/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_ui_server.py
+++ b/ambari-server/src/test/python/stacks/2.1.1/STORM/test_storm_ui_server.py
@@ -64,12 +64,16 @@ class TestStormUiServer(RMFTestCase):
                        command = "stop",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/ui.pid` >/dev/null 2>&1')
+
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/ui.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/ui.pid >/dev/null 2>&1 && ps `cat /var/run/storm/ui.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/ui.pid >/dev/null 2>&1 && ps `cat /var/run/storm/ui.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/ui.pid')
+    self.assertNoMoreResources()
 
   def test_configure_default(self):
     self.executeScript("2.1.1/services/STORM/package/scripts/ui_server.py",
@@ -110,12 +114,15 @@ class TestStormUiServer(RMFTestCase):
                        command = "stop",
                        config_file="secured.json"
     )
-    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/ui.pid` >/dev/null 2>&1')
+    self.assertResourceCalled('Execute', 'kill `cat /var/run/storm/ui.pid` >/dev/null 2>&1',
+      not_if = '! (ls /var/run/storm/ui.pid >/dev/null 2>&1 && ps `cat /var/run/storm/ui.pid` >/dev/null 2>&1)',
+    )
     self.assertResourceCalled('Execute', '! (ls /var/run/storm/ui.pid >/dev/null 2>&1 && ps `cat /var/run/storm/ui.pid` >/dev/null 2>&1)',
       tries = 5,
       try_sleep = 3,
     )
     self.assertResourceCalled('Execute', 'rm -f /var/run/storm/ui.pid')
+    self.assertNoMoreResources()
 
   def assert_configure_default(self):