You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/11/05 20:31:45 UTC
git commit: AMBARI-8135. Kafka Service Check does not show any output
in case of either success or failure. (Sriharsha Chintalapani via yusaku)
Repository: ambari
Updated Branches:
refs/heads/branch-1.7.0 766838b5f -> 9a8053c03
AMBARI-8135. Kafka Service Check does not show any output in case of either success or failure. (Sriharsha Chintalapani via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a8053c0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a8053c0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a8053c0
Branch: refs/heads/branch-1.7.0
Commit: 9a8053c03fb3790b295a231e7f6b6e43c82161bb
Parents: 766838b
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Wed Nov 5 11:32:00 2014 -0800
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Wed Nov 5 11:32:00 2014 -0800
----------------------------------------------------------------------
.../2.2/services/KAFKA/package/scripts/service_check.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/9a8053c0/ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/service_check.py
index 4b76ef1..c2b4bc1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/service_check.py
@@ -17,7 +17,7 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
-
+from __future__ import print_function
from resource_management import *
import sys,subprocess,os
@@ -29,13 +29,20 @@ class ServiceCheck(Script):
self.set_env(params.conf_dir)
create_topic_cmd_created_output = "Created topic \"ambari_kafka_service_check\"."
create_topic_cmd_exists_output = "Topic \"ambari_kafka_service_check\" already exists."
+ print("Running kafka create topic command", file=sys.stdout)
create_topic_cmd = [params.kafka_home+'/bin/kafka-topics.sh', '--zookeeper '+kafka_config['zookeeper.connect'],
'--create --topic ambari_kafka_service_check', '--partitions 1 --replication-factor 1']
+ print(" ".join(create_topic_cmd), file=sys.stdout)
create_topic_process = subprocess.Popen(create_topic_cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
out, err = create_topic_process.communicate()
- if out.find(create_topic_cmd_created_output) != -1 or out.find(create_topic_cmd_exists_output) != -1:
+ if out.find(create_topic_cmd_created_output) != -1:
+ print(out, file=sys.stdout)
+ sys.exit(0)
+ elif out.find(create_topic_cmd_exists_output) != -1:
+ print("Topic ambari_kafka_service_check exists", file=sys.stdout)
sys.exit(0)
else:
+ print(out, file=sys.stderr)
sys.exit(1)
def read_kafka_config(self,kafka_conf_dir):