Repository: ambari
Updated Branches:
  refs/heads/trunk 56f4c618a -> e9cfce9c3


AMBARI-16631. Ambari should check if the PID changes after restart, to confirm 
the process has been restarted (aonishuk)


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

Branch: refs/heads/trunk
Commit: e9cfce9c38bd6f80974bd438f2434a44d14a4b02
Parents: 56f4c61
Author: Andrew Onishuk <[email protected]>
Authored: Thu May 12 14:38:37 2016 +0300
Committer: Andrew Onishuk <[email protected]>
Committed: Thu May 12 14:38:37 2016 +0300

----------------------------------------------------------------------
 .../python/resource_management/libraries/script/script.py   | 8 ++++++++
 .../test/python/stacks/2.2/RANGER/test_ranger_usersync.py   | 9 +++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e9cfce9c/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/script/script.py 
b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index f578fc4..cbf313e 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -655,6 +655,14 @@ class Script(object):
         else:
           self.pre_rolling_restart(env)
 
+      try:
+        self.status(env)
+        raise Fail("Stop command finished but process keep running.")
+      except ComponentIsNotRunning as e:
+        pass  # expected
+      except ClientComponentHasNoStatus as e:
+        pass  # expected
+
       # To remain backward compatible with older stacks, only pass 
upgrade_type if available.
       # TODO, remove checking the argspec for "upgrade_type" once all of the 
services support that optional param.
       self.pre_start()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e9cfce9c/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py 
b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
index 5ca6c62..98a0b38 100644
--- a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
+++ b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
@@ -118,8 +118,9 @@ class TestRangerUsersync(RMFTestCase):
                        command = "restart",
                        config_file="ranger-usersync-upgrade.json",
                        stack_version = self.STACK_VERSION,
-                       target = RMFTestCase.TARGET_COMMON_SERVICES)
-
+                       target = RMFTestCase.TARGET_COMMON_SERVICES,
+                       call_mocks = [(1, None)]
+    )
     self.assertTrue(setup_usersync_mock.called)
     self.assertResourceCalled("Execute", ("/usr/bin/ranger-usersync-stop",),
                               environment = {'JAVA_HOME': 
u'/usr/jdk64/jdk1.7.0_67'},
@@ -143,7 +144,7 @@ class TestRangerUsersync(RMFTestCase):
                        config_dict = json_content,
                        stack_version = self.STACK_VERSION,
                        target = RMFTestCase.TARGET_COMMON_SERVICES,
-                       call_mocks = [(0, None, ''), (0, None)],
+                       call_mocks = [(0, None, ''), (1, None), (0, None)],
                        mocks_dict = mocks_dict)
 
     self.assertTrue(setup_usersync_mock.called)
@@ -152,7 +153,7 @@ class TestRangerUsersync(RMFTestCase):
                               sudo = True)
     self.assertResourceCalledIgnoreEarlier("Execute", ('ambari-python-wrap', 
'/usr/bin/hdp-select', 'set', 'ranger-usersync', '2.3.0.0-1234'), sudo=True)
 
-    self.assertEquals(2, mocks_dict['call'].call_count)
+    self.assertEquals(3, mocks_dict['call'].call_count)
     self.assertEquals(1, mocks_dict['checked_call'].call_count)
     self.assertEquals(
       ('ambari-python-wrap', '/usr/bin/conf-select', 'set-conf-dir', 
'--package', 'ranger-usersync', '--stack-version', '2.3.0.0-1234', 
'--conf-version', '0'),

Reply via email to