summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2015-05-20 12:59:52 +0000
committerAlan Conway <aconway@apache.org>2015-05-20 12:59:52 +0000
commit0f3ce19450aa3bc96d42d0a58fa74813b4b9f428 (patch)
tree4dbbdeaced1df506d9879980748ee1bee4037af5
parent525878991d3b85858b37edbf9916eaed5d31835e (diff)
downloadqpid-python-0f3ce19450aa3bc96d42d0a58fa74813b4b9f428.tar.gz
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. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1680552 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xqpid/cpp/etc/qpidd.in48
1 files changed, 26 insertions, 22 deletions
diff --git a/qpid/cpp/etc/qpidd.in b/qpid/cpp/etc/qpidd.in
index 411f212119..d363308c7f 100755
--- a/qpid/cpp/etc/qpidd.in
+++ b/qpid/cpp/etc/qpidd.in
@@ -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