summaryrefslogtreecommitdiff
path: root/qpid/cpp/etc
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2014-04-23 12:42:35 +0000
committerAlan Conway <aconway@apache.org>2014-04-23 12:42:35 +0000
commit35de9683349c40207ea136b6ff38808722a14cda (patch)
tree3327cdd36bc84ac28aec2ed49366b845d123858b /qpid/cpp/etc
parent6573b161cfdb7cc96281d73ff3903f1401d51fb8 (diff)
downloadqpid-python-35de9683349c40207ea136b6ff38808722a14cda.tar.gz
QPID-5711: HA cannot promote primary if SASL security is enabled.
Updated the qpid-ha tool and qpidd init scripts to handle SASL authentication. The qpid-ha script as as called by the qpidd-primary init script now reads authentication settings from the qpidd.conf file and uses them to connect to the local broker. - qpidd-primary script respects prefix: use installed location for qpidd script, not "service" call - qpid-ha added --config option qpid-ha options to use qpidd.conf for local broker connection. - qpid-ha --all use user/pass for each broker. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1589391 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/etc')
-rw-r--r--qpid/cpp/etc/CMakeLists.txt3
-rwxr-xr-xqpid/cpp/etc/qpidd-primary.in39
-rwxr-xr-xqpid/cpp/etc/qpidd.in10
3 files changed, 29 insertions, 23 deletions
diff --git a/qpid/cpp/etc/CMakeLists.txt b/qpid/cpp/etc/CMakeLists.txt
index 6158b9e27b..c39257e6cc 100644
--- a/qpid/cpp/etc/CMakeLists.txt
+++ b/qpid/cpp/etc/CMakeLists.txt
@@ -19,11 +19,12 @@
if (UNIX)
- # Use automake variable names as these files are also configured by automake.
# Use absolute paths as these are substituted into init scripts.
set_absolute_install_path (bindir ${QPID_INSTALL_BINDIR})
set_absolute_install_path (sysconfdir ${SYSCONF_INSTALL_DIR})
set_absolute_install_path (sbindir ${QPID_INSTALL_SBINDIR})
+ set_absolute_install_path (initdir ${QPID_INSTALL_INITDDIR})
+ set_absolute_install_path (confdir ${QPID_INSTALL_CONFDIR})
configure_file(qpidd.in
${CMAKE_CURRENT_BINARY_DIR}/qpidd
diff --git a/qpid/cpp/etc/qpidd-primary.in b/qpid/cpp/etc/qpidd-primary.in
index 64537b9b1d..377f2d623a 100755
--- a/qpid/cpp/etc/qpidd-primary.in
+++ b/qpid/cpp/etc/qpidd-primary.in
@@ -37,27 +37,28 @@
prog=qpidd
-# Source function library.
-. /etc/rc.d/init.d/functions
+# The following variables can be overridden in @sysconfdir@/sysconfig/$prog
+QPID_INIT=@initdir@/$prog
+QPID_CONFIG=@confdir@/qpidd.conf
+QPID_HA=@bindir@/qpid-ha
+QPID_HA_OPTIONS="--config $QPID_CONFIG"
-if [ -f @sysconfdir@/sysconfig/$prog ] ; then
- . @sysconfdir@/sysconfig/$prog
-fi
+# Source configuration
+test -f @sysconfdir@/sysconfig/$prog && source @sysconfdir@/sysconfig/$prog
-# The following variables can be overridden in @sysconfdir@/sysconfig/$prog
-[[ $QPID_PORT ]] || QPID_PORT=5672
-[[ $QPID_HA ]] || QPID_HA=@bindir@/qpid-ha
-export QPID_PORT
+# Check presence of executables/scripts
+for f in $QPID_INIT $QPID_HA; do
+ test -x $f || { echo "$f not found or not executable"; exit 5; }
+done
-RETVAL=0
+QPID_HA="$QPID_HA $QPID_HA_OPTIONS"
-#ensure binary is present and executable
-if [[ !(-x $QPID_HA) ]]; then
- echo "qpid-ha executable not found or not executable"
-fi
+source /etc/rc.d/init.d/functions
+
+RETVAL=0
status() {
- if $QPID_HA -b localhost:$QPID_PORT status --is-primary ; then
+ if $QPID_HA status --is-primary ; then
echo "qpidd is primary"
else
echo "qpidd is not primary"
@@ -66,14 +67,14 @@ status() {
}
start() {
- service qpidd start
+ $QPID_INIT start
echo -n $"Promoting qpid daemon to cluster primary: "
- $QPID_HA -b localhost:$QPID_PORT promote
+ $QPID_HA promote
[ "$?" -eq 0 ] && success || failure
}
stop() {
- service qpidd stop
+ $QPID_INIT stop
}
reload() {
@@ -82,7 +83,7 @@ reload() {
}
restart() {
- service qpidd restart && start
+ $QPID_INIT restart && start
}
# See how we were called.
diff --git a/qpid/cpp/etc/qpidd.in b/qpid/cpp/etc/qpidd.in
index b8d0e87038..55697492e4 100755
--- a/qpid/cpp/etc/qpidd.in
+++ b/qpid/cpp/etc/qpidd.in
@@ -39,6 +39,11 @@ prog=qpidd
lockfile=/var/lock/subsys/$prog
pidfile=/var/run/qpidd.pid
+# The following variables can be overridden in @sysconfdir@/sysconfig/$prog
+QPID_BIN=@sbindir@/$prog
+QPID_CONFIG=@confdir@/qpidd.conf
+QPID_DATA_DIR=/var/lib/qpidd
+
# Source configuration
if [ -f @sysconfdir@/sysconfig/$prog ] ; then
. @sysconfdir@/sysconfig/$prog
@@ -63,9 +68,8 @@ if [ $RETVAL = 4 ]; then
fi
start() {
- [[ $QPID_DATA_DIR ]] || QPID_DATA_DIR=/var/lib/qpidd
echo -n $"Starting Qpid AMQP daemon: "
- daemon --pidfile $pidfile --check $prog --user qpidd @sbindir@/$prog --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS
+ daemon --pidfile $pidfile --check $prog --user qpidd $QPID_BIN --config $QPID_CONFIG --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch $lockfile
@@ -73,7 +77,7 @@ start() {
touch $pidfile
chown qpidd.qpidd $pidfile
[ -x /sbin/restorecon ] && /sbin/restorecon $pidfile
- runuser - -s /bin/sh qpidd -c "@sbindir@/$prog --check > $pidfile"
+ runuser - -s /bin/sh qpidd -c "$QPID_BIN --check > $pidfile"
fi
return $RETVAL
}