Преглед изворни кода

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

Sumit Mohanty пре 10 година
родитељ
комит
f3359f526e
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      ambari-agent/src/main/python/ambari_agent/hostname.py

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

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