qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1680552 - /qpid/trunk/qpid/cpp/etc/qpidd.in
Date Wed, 20 May 2015 12:59:52 GMT
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


Mime
View raw message