Updated Branches:
  refs/heads/trunk ac89d969b -> 9d55ab937

AMBARI-3695. "Confirm hosts" shows "ntpd not running" warning, but it's running 
on host (Dmytro Shkvyra via dlysnichenko)


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

Branch: refs/heads/trunk
Commit: 9d55ab9375a1a9eb59909aab756fe3972eeedc5f
Parents: ac89d96
Author: Lisnichenko Dmitro <[email protected]>
Authored: Tue Nov 5 21:24:22 2013 +0200
Committer: Lisnichenko Dmitro <[email protected]>
Committed: Tue Nov 5 21:25:24 2013 +0200

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/HostInfo.py | 11 +++++++++--
 ambari-agent/src/test/python/TestHostInfo.py          |  2 ++
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9d55ab93/ambari-agent/src/main/python/ambari_agent/HostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HostInfo.py 
b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
index 6448a90..b737272 100644
--- a/ambari-agent/src/main/python/ambari_agent/HostInfo.py
+++ b/ambari-agent/src/main/python/ambari_agent/HostInfo.py
@@ -113,6 +113,10 @@ class HostInfo:
     FIREWALL_SERVICE_NAME = "ufw"
 
   FIREWALL_STATUS_CMD = "%s %s status" % (SERVICE_CMD, FIREWALL_SERVICE_NAME)
+  
+  DEFAULT_SERVICE_NAME = "ntpd"
+  SERVICE_STATUS_CMD = "%s %s status" % (SERVICE_CMD, DEFAULT_SERVICE_NAME)
+  
   event = threading.Event()
   
   current_umask = -1
@@ -171,12 +175,15 @@ class HostInfo:
         serviceName = service[osType]
       else:
         serviceName = service
-
+      
+      service_check_live = shlex.split(self.SERVICE_STATUS_CMD)
+      service_check_live[1] = serviceName
+      
       svcCheckResult['name'] = serviceName
       svcCheckResult['status'] = "UNKNOWN"
       svcCheckResult['desc'] = ""
       try:
-        osStat = subprocess.Popen(shlex.split(self.FIREWALL_STATUS_CMD), 
stdout=subprocess.PIPE,
+        osStat = subprocess.Popen(service_check_live, stdout=subprocess.PIPE,
                                   stderr=subprocess.PIPE)
         out, err = osStat.communicate()
         if 0 != osStat.returncode:

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/9d55ab93/ambari-agent/src/test/python/TestHostInfo.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/TestHostInfo.py 
b/ambari-agent/src/test/python/TestHostInfo.py
index a4624ea..5718058 100644
--- a/ambari-agent/src/test/python/TestHostInfo.py
+++ b/ambari-agent/src/test/python/TestHostInfo.py
@@ -463,6 +463,8 @@ class TestHostInfo(TestCase):
     self.assertEquals(result[0]['status'], 'Healthy')
     self.assertEquals(result[0]['name'], 'service1')
     self.assertEquals(result[0]['desc'], '')
+    self.assertEquals(str(subproc_popen.call_args_list),
+                      "[call(['/sbin/service', 'service1', 'status'], 
stderr=-1, stdout=-1)]")
 
     p.returncode = 1
     p.communicate.return_value = ('out', 'err')

Reply via email to