#!/bin/bash # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # Sets up the messaging backend service needed by the AMQP 1.0 # transport (amqp://) # # Environment Configuration # # AMQP1_SERVICE - identifies the messaging backend to use. Should be # one of 'qpid', ... # @TODO(kgiusti) add qpid-dispatch, rabbitmq, etc # AMQP1_HOST - the host:port used to connect to the messaging service. # Defaults to 127.0.0.1:5672 # AMQP1_{USERNAME,PASSWORD} - for authentication with AMQP1_HOST # # builds transport url string function _get_amqp1_transport_url { echo "amqp://$AMQP1_USERNAME:$AMQP1_PASSWORD@$AMQP1_HOST:5672/" } # install packages necessary for support of the oslo.messaging AMQP # 1.0 driver function _install_pyngus { # Install pyngus client API if is_fedora; then # TODO(kgiusti) due to a bug in the way pip installs wheels, # do not let pip install the proton python bindings as it will # put them in the wrong path: # https://github.com/pypa/pip/issues/2940 install_package python-qpid-proton elif is_ubuntu; then # ditto install_package python-qpid-proton fi pip_install_gr pyngus } # remove packages used by oslo.messaging AMQP 1.0 driver function _remove_pyngus { # TODO(kgiusti) no way to pip uninstall? # pip_install_gr pyngus : } # Set up the various configuration files used by the qpidd broker function _configure_qpid { # the location of the configuration files have changed since qpidd 0.14 local qpid_conf_file if [ -e /etc/qpid/qpidd.conf ]; then qpid_conf_file=/etc/qpid/qpidd.conf elif [ -e /etc/qpidd.conf ]; then qpid_conf_file=/etc/qpidd.conf else exit_distro_not_supported "qpidd.conf file not found!" fi # ensure that the qpidd service can read its config sudo chmod o+r $qpid_conf_file # force the ACL file to a known location local qpid_acl_file=/etc/qpid/qpidd.acl if [ ! -e $qpid_acl_file ]; then sudo mkdir -p -m 755 `dirname $qpid_acl_file` sudo touch $qpid_acl_file sudo chmod o+r $qpid_acl_file fi sudo sed -i.bak '/^acl-file=/d' $qpid_conf_file echo "acl-file=$qpid_acl_file" | sudo tee --append $qpid_conf_file sudo sed -i '/^auth=/d' $qpid_conf_file if [ -z "$AMQP1_USERNAME" ]; then # no QPID user configured, so disable authentication # and access control echo "auth=no" | sudo tee --append $qpid_conf_file cat <