Repository: ambari Updated Branches: refs/heads/trunk c68cf2fdc -> 5ad408c98
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/5ad408c9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5ad408c9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5ad408c9 Branch: refs/heads/trunk Commit: 5ad408c98353ce84e58fb575713154d8570f03a5 Parents: c68cf2f Author: Yusaku Sako <yus...@hortonworks.com> Authored: Wed Nov 5 11:32:00 2014 -0800 Committer: Yusaku Sako <yus...@hortonworks.com> Committed: Wed Nov 5 11:32:40 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/5ad408c9/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):