Pārlūkot izejas kodu

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

Siddharth Wagle 11 gadi atpakaļ
vecāks
revīzija
661d4d16a2

+ 6 - 3
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)