Переглянути джерело

Ambari-7767. Add an agent config to discover server hostname via a script

Sumit Mohanty 10 роки тому
батько
коміт
f3359f526e

+ 5 - 2
ambari-agent/src/main/python/ambari_agent/hostname.py

@@ -67,7 +67,7 @@ def public_hostname(config):
       out, err = output.communicate()
       if (0 == output.returncode and 0 != len(out.strip())):
         cached_public_hostname = out.strip()
-        logger.info("Read public hostname " + cached_public_hostname + "using agent:public_hostname_script")
+        logger.info("Read public hostname '" + cached_public_hostname + "' using agent:public_hostname_script")
         return cached_public_hostname
   except:
     #ignore for now.
@@ -87,6 +87,9 @@ def public_hostname(config):
   return cached_public_hostname
 
 def server_hostname(config):
+  """
+  Reads the ambari server name from the config or using the supplied script
+  """
   global cached_server_hostname
   if cached_server_hostname is not None:
     return cached_server_hostname
@@ -98,7 +101,7 @@ def server_hostname(config):
       out, err = osStat.communicate()
       if (0 == osStat.returncode and 0 != len(out.strip())):
         cached_server_hostname = out.strip()
-        logger.info("Read server hostname " + cached_server_hostname + "using server:hostname_script")
+        logger.info("Read server hostname '" + cached_server_hostname + "' using server:hostname_script")
     except Exception, err:
       logger.info("Unable to execute hostname_script for server hostname. " + str(err))