ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swa...@apache.org
Subject git commit: AMBARI-3983. Create a helper script to relocate host components. Stop on verify. (swagle)
Date Thu, 05 Dec 2013 00:41:29 GMT
Updated Branches:
  refs/heads/trunk d6c1c1c16 -> 649757319


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


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

Branch: refs/heads/trunk
Commit: 649757319e38b3702f4bf637f5696d9fb6b18c1b
Parents: d6c1c1c
Author: Siddharth Wagle <swagle@hortonworks.com>
Authored: Wed Dec 4 16:37:37 2013 -0800
Committer: Siddharth Wagle <swagle@hortonworks.com>
Committed: Wed Dec 4 16:37:37 2013 -0800

----------------------------------------------------------------------
 .../src/main/resources/scripts/relocate_resources.py   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/64975731/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 c537cb4..5ab4bd4 100644
--- a/ambari-server/src/main/resources/scripts/relocate_resources.py
+++ b/ambari-server/src/main/resources/scripts/relocate_resources.py
@@ -114,10 +114,12 @@ class AmbariResource:
     if not self.isInitialized:
       raise Exception('Resource not initialized')
 
-    if self.old_hostname == new_hostname:
-      raise Exception('New hostname is same as existing host name, %s' % self.old_hostname)
-
-    self.verifyHostComponentStatus(self.old_hostname, new_hostname, self.componentName)
+    try:
+      self.verifyHostComponentStatus(self.old_hostname, new_hostname, self.componentName)
+    except Exception, e:
+      logger.error("Exception caught on verify relocate request.")
+      logger.error(e.message)
+      sys.exit(1)
 
     # Delete current host component
     self.deleteHostComponent(self.old_hostname, self.componentName)
@@ -210,6 +212,9 @@ class AmbariResource:
     pass
 
   def verifyHostComponentStatus(self, old_hostname, new_hostname, componentName):
+    if old_hostname == new_hostname:
+      raise Exception('New hostname is same as existing host name, %s' % old_hostname)
+
     # Check desired state of host component is not STOPPED or host is
     # unreachable
     actualState = self.getHostComponentState(old_hostname, componentName)


Mime
View raw message