You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2015/09/17 19:25:28 UTC

[2/2] ambari git commit: AMBARI-13128. RU: Kafka Service Check failed after retry (dlysnichenko)

AMBARI-13128. RU: Kafka Service Check failed after retry (dlysnichenko)


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

Branch: refs/heads/branch-2.1
Commit: 9795cc1317767ced9c9eed6babe13c35639698da
Parents: 87e9ded
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Sep 17 20:24:32 2015 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Sep 17 20:25:17 2015 +0300

----------------------------------------------------------------------
 .../KAFKA/0.8.1.2.2/package/scripts/service_check.py | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9795cc13/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
index f76e954..d8acd4a 100644
--- a/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/KAFKA/0.8.1.2.2/package/scripts/service_check.py
@@ -21,6 +21,7 @@ from resource_management.libraries.script.script import Script
 from resource_management.libraries.functions.validate import call_and_match_output
 from resource_management.libraries.functions.format import format
 from resource_management.core.logger import Logger
+from resource_management.core import sudo
 
 class ServiceCheck(Script):
   def service_check(self, env):
@@ -45,13 +46,13 @@ class ServiceCheck(Script):
     import params
     
     kafka_config = {}
-    with open(params.conf_dir+"/server.properties", "r") as conf_file:
-      for line in conf_file:
-        if line.startswith("#") or not line.strip():
-          continue 
-        
-        key,value = line.split("=")
-        kafka_config[key] = value.replace("\n","")
+    content = sudo.read_file(params.conf_dir + "/server.properties")
+    for line in content.splitlines():
+      if line.startswith("#") or not line.strip():
+        continue
+
+      key, value = line.split("=")
+      kafka_config[key] = value.replace("\n", "")
     
     return kafka_config