"Fossies" - the Fresh Open Source Software Archive

Member "monasca-events-api-2.0.0/devstack/lib/kafka.sh" (14 Oct 2020, 950 Bytes) of package /linux/misc/openstack/monasca-events-api-2.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "kafka.sh": 0.2.0_vs_0.3.0.

    1 #!/bin/bash
    2 
    3 # Copyright 2017 FUJITSU LIMITED
    4 #
    5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    6 # not use this file except in compliance with the License. You may obtain
    7 # a copy of the License at
    8 #
    9 #      http://www.apache.org/licenses/LICENSE-2.0
   10 #
   11 # Unless required by applicable law or agreed to in writing, software
   12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   14 # License for the specific language governing permissions and limitations
   15 # under the License.
   16 
   17 
   18 _XTRACE_KAFKA=$(set +o | grep xtrace)
   19 set +o xtrace
   20 
   21 function is_kafka_enabled {
   22     is_service_enabled monasca-kafka && return 0
   23     return 1
   24 }
   25 
   26 function create_kafka_topic {
   27     if is_kafka_enabled; then
   28         /opt/kafka/bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 4 --topic $1
   29     fi
   30 }
   31 
   32 $_XTRACE_KAFKA