You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2019/06/29 14:47:22 UTC

svn commit: r1862314 - /uima/uima-ducc/trunk/src/main/admin/ducc_util.py

Author: degenaro
Date: Sat Jun 29 14:47:22 2019
New Revision: 1862314

URL: http://svn.apache.org/viewvc?rev=1862314&view=rev
Log:
UIMA-6086 DUCC reliability should use keepalived.conf to determine virtual ip address

Modified:
    uima/uima-ducc/trunk/src/main/admin/ducc_util.py

Modified: uima/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1862314&r1=1862313&r2=1862314&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Sat Jun 29 14:47:22 2019
@@ -712,21 +712,25 @@ class DuccUtil(DuccBase):
         label = 'get_ip_address'
         result = None
         try:
-            p = subprocess.Popen(['/usr/bin/nslookup', hostname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-            output, err = p.communicate()
-            #print hostname, output, err
-            name = None
-            for line in output.splitlines():
-                tokens = line.split()
-                if(len(tokens) == 2):
-                    t0 = tokens[0]
-                    t1 = tokens[1]
-                    if(t0 == 'Address:'):
-                        if(name != None):
-                            result = t1
-                            break
-                    elif(t0 == 'Name:'):
-                        name = t1
+            # get virtual ip address from keepalived.conf
+            result = self.get_virtual_ipaddress()
+            if(result == None):
+                # get virtual ip address from nameserver
+                p = subprocess.Popen(['/usr/bin/nslookup', hostname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+                output, err = p.communicate()
+                #print hostname, output, err
+                name = None
+                for line in output.splitlines():
+                    tokens = line.split()
+                    if(len(tokens) == 2):
+                        t0 = tokens[0]
+                        t1 = tokens[1]
+                        if(t0 == 'Address:'):
+                            if(name != None):
+                                result = t1
+                                break
+                        elif(t0 == 'Name:'):
+                            name = t1
         except Exception as e:
             print e
         debug(label, str(result))
@@ -1355,7 +1359,7 @@ class DuccUtil(DuccBase):
 
     def get_virtual_ipaddress(self):
         state = 0
-        vip = 'unspecified'
+        vip = None
         if ( os.path.exists(self.keepalived_conf) ):
             with open(self.keepalived_conf) as f:
                 for line in f: