Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2B97017825 for ; Wed, 20 May 2015 12:59:53 +0000 (UTC) Received: (qmail 63797 invoked by uid 500); 20 May 2015 12:59:53 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 63772 invoked by uid 500); 20 May 2015 12:59:53 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 63758 invoked by uid 99); 20 May 2015 12:59:53 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 May 2015 12:59:53 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id E3D7EAC0A57 for ; Wed, 20 May 2015 12:59:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1680552 - /qpid/trunk/qpid/cpp/etc/qpidd.in Date: Wed, 20 May 2015 12:59:52 -0000 To: commits@qpid.apache.org From: aconway@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150520125952.E3D7EAC0A57@hades.apache.org> Author: aconway Date: Wed May 20 12:59:52 2015 New Revision: 1680552 URL: http://svn.apache.org/r1680552 Log: QPID-6549: `service qpidd status` returns 1 - hidden error is "ConnectionError: connection-forced: Connection must be encrypted.(320)" The qpidd init script uses qpid-ha to probe the state of the broker. In the bug reported security configuration on the broker was preventing qpid-ha from connecting. The qpid-ha checks are only necessary when HA is configured, so this commit disables those checks if it is not configured. Modified: qpid/trunk/qpid/cpp/etc/qpidd.in Modified: qpid/trunk/qpid/cpp/etc/qpidd.in URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/etc/qpidd.in?rev=1680552&r1=1680551&r2=1680552&view=diff ============================================================================== --- qpid/trunk/qpid/cpp/etc/qpidd.in (original) +++ qpid/trunk/qpid/cpp/etc/qpidd.in Wed May 20 12:59:52 2015 @@ -54,21 +54,33 @@ source /etc/rc.d/init.d/functions # Data dir: respect the config file if set. grep -q '^ *data-dir *=' $QPID_CONFIG || QPIDD_OPTIONS="$QPIDD_OPTIONS --data-dir=$QPID_DATA_DIR" +# Check for HA configuration +if grep -iq '^ *ha-cluster *= *\(true\|on\|1\|yes\)' $QPID_CONFIG; then + # HA is configured, do some extra checks. + test -x $QPID_HA || { echo "HA configured but $QPID_HA not found"; return 5; } + + ha_ping() { $QPID_HA $QPID_HA_OPTIONS ping >/dev/null 2>&1; } + + ha_allow_stop() { + # Primary script does not stop backup brokers and vice versa. + if $QPID_HA $QPID_HA_OPTIONS status --is-primary 2>&1 > /dev/null; then + [ "$1" = primary ] || { echo -n "stop primary broker with 'qpidd-primary stop'"; return 1; } + else + [ "$1" = primary ] && { echo -n "stop backup broker with 'qpidd stop'"; return 1; } + fi + return 0 + } +else + # No HA configuration, HA checks are no-ops. + ha_ping() { true; } + ha_allow_stop() { true; } +fi + # Check presence of executables/scripts for f in $QPID_BIN; do test -x $f || { echo "$f not found or not executable"; exit 5; } done -qpid_ping() { - test -x $QPID_HA || return 0 # Only if qpid-ha installed - $QPID_HA $QPID_HA_OPTIONS ping >/dev/null 2>&1 -} - -qpid_is_primary() { - # Only if qpid-ha is installed. - test -x $QPID_HA && $QPID_HA $QPID_HA_OPTIONS status --is-primary >/dev/null 2>&1 -} - RETVAL=0 # Ensure user has sufficient permissions @@ -81,7 +93,7 @@ fi do_status() { # Check PID file and ping for liveness MESSAGE=$(status -p $pidfile $prog) && { - qpid_ping || return 1 + ha_ping || return 1 } RC=$? echo $MESSAGE @@ -112,26 +124,18 @@ start() { stop() { lock - # Primary script does not stop backup brokers and vice versa. - if qpid_is_primary; then - [ "$1" != primary ] && SKIP="Not stopping Qpid daemon, primary" - else - [ "$1" = primary ] && SKIP="Not stopping Qpid daemon, not primary" - fi - if [ -n "$SKIP" ]; then - echo -n "$SKIP: " - success - RETVAL=0 - else + if ha_allow_stop $1; then echo -n $"Stopping Qpid AMQP daemon: " killproc -p ${pidfile} $prog RETVAL=$? [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} fi + [ "$RETVAL" = 0 ] && success echo return $RETVAL } + reload() { echo 1>&2 $"$0: reload not supported" return 3 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org