You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2013/12/05 02:09:57 UTC

git commit: AMBARI-3983. Create a helper script to relocate host components. Exit on wait. (swagle)

Updated Branches:
  refs/heads/trunk 649757319 -> 33688dd88


AMBARI-3983. Create a helper script to relocate host components. Exit on wait. (swagle)


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

Branch: refs/heads/trunk
Commit: 33688dd8843409d7568f8642bff930ad98e49e8f
Parents: 6497573
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Wed Dec 4 16:50:34 2013 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Wed Dec 4 16:50:34 2013 -0800

----------------------------------------------------------------------
 .../src/main/resources/scripts/relocate_resources.py          | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/33688dd8/ambari-server/src/main/resources/scripts/relocate_resources.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/scripts/relocate_resources.py b/ambari-server/src/main/resources/scripts/relocate_resources.py
index 5ab4bd4..1dab855 100644
--- a/ambari-server/src/main/resources/scripts/relocate_resources.py
+++ b/ambari-server/src/main/resources/scripts/relocate_resources.py
@@ -146,6 +146,7 @@ class AmbariResource:
   def waitOnHostComponentUpdate(self, hostname, componentName, status):
     logger.info("Waiting for host component status to update ...")
     sleep_itr = 0
+    state = None
     while sleep_itr < STATUS_WAIT_TIMEOUT:
       try:
         state = self.getHostComponentState(hostname, componentName)
@@ -156,10 +157,16 @@ class AmbariResource:
       except Exception, e:
         logger.error("Caught an exception waiting for status update.. "
                      "continuing to wait...")
+      pass
 
       time.sleep(STATUS_CHECK_INTERVAL)
       sleep_itr += STATUS_CHECK_INTERVAL
     pass
+    if state and state != status:
+      logger.error("Timed out on wait, status unchanged. status = %s" % state)
+      sys.exit(1)
+    pass
+  pass
 
   def addHostComponent(self, hostname, componentName):
     data = '{"host_components":[{"HostRoles":{"component_name":"%s"}}]}' % self.componentName