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/06 01:38:50 UTC

git commit: AMBARI-3983. Create a helper script to relocate host components. Non failover handling. (swagle)

Updated Branches:
  refs/heads/trunk e9837042d -> 661d4d16a


AMBARI-3983. Create a helper script to relocate host components. Non failover handling. (swagle)


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

Branch: refs/heads/trunk
Commit: 661d4d16a2c9a90f0cb316c57957076f6d7a5e10
Parents: e983704
Author: Siddharth Wagle <sw...@hortonworks.com>
Authored: Thu Dec 5 16:38:31 2013 -0800
Committer: Siddharth Wagle <sw...@hortonworks.com>
Committed: Thu Dec 5 16:38:40 2013 -0800

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/661d4d16/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 ebf38fe..e5740e5 100644
--- a/ambari-server/src/main/resources/scripts/relocate_resources.py
+++ b/ambari-server/src/main/resources/scripts/relocate_resources.py
@@ -113,6 +113,12 @@ class AmbariResource:
     if not self.isInitialized:
       raise Exception('Resource not initialized')
 
+    # If old and new hostname are the same exit harmlessly
+    if old_hostname == new_hostname:
+      logger.error('New hostname is same as existing host name, %s' % old_hostname)
+      sys.exit(2)
+    pass
+
     try:
       self.verifyHostComponentStatus(self.old_hostname, new_hostname, self.componentName)
     except Exception, e:
@@ -218,9 +224,6 @@ 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)