Addresses bug https://bugzilla.redhat.com/show_bug.cgi?id=735426
- currently if we have certain shell script variables defined like the array ${array[@]} cmake presents a malformed error message where it thinks we are missing the closing '}'. correct this by using @ONLY so cmake only cares about @VAR@ when doing its string replacements.
Signed-off-by: Adam Stokes astokes@fedoraproject.org --- CMakeLists.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7555b4..54694d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,10 +116,10 @@ else(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/matahari.init)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.init.in - ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker) + ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.sysconf.in - ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.sysconf) + ${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.sysconf @ONLY)
install(DIRECTORY DESTINATION ${localstatedir}/lib/matahari DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
ACK
On 09/05/2011 09:09 PM, Adam Stokes wrote:
- currently if we have certain shell script variables defined like the array ${array[@]} cmake presents a malformed error message where it thinks we are missing the closing '}'. correct this by using @ONLY so cmake only cares about @VAR@ when doing its string replacements.
Signed-off-by: Adam Stokesastokes@fedoraproject.org
CMakeLists.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt index f7555b4..54694d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,10 +116,10 @@ else(WIN32) ${CMAKE_CURRENT_BINARY_DIR}/matahari.init)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.init.in
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker)
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/matahari-broker.sysconf.in
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.sysconf)
${CMAKE_CURRENT_BINARY_DIR}/matahari-broker.sysconf @ONLY)
install(DIRECTORY DESTINATION ${localstatedir}/lib/matahari DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
Signed-off-by: Adam Stokes astokes@fedoraproject.org --- matahari-broker.init.in | 47 ++++++++++++++++++++++++++++++++++++++++++++ matahari-broker.sysconf.in | 8 +++++++ 2 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/matahari-broker.init.in b/matahari-broker.init.in index e74926c..7014e3d 100755 --- a/matahari-broker.init.in +++ b/matahari-broker.init.in @@ -43,11 +43,55 @@ pidfile=@localstatedir@/run/matahari-broker.pid # Turn off automatic systemd redirects #SYSTEMCTL_SKIP_REDIRECT=1
+# Timeout for qpid-route in seconds +TIMEOUT=5 + # Source function library. . @sysconfdir@/rc.d/init.d/functions
RETVAL=0
+# Enable broker federation +federate() { + unset array + declare -a array + for name in $@ + do + case $name in + *_matahari-broker._tcp*) + RESP=`dig SRV $name +short| awk '{print $4":"$3}'|sed 's/.:/:/'` + array+=$RESP + ;; + *:[[:digit:]]*) + array+=$name + ;; + *) + echo -n $"Invalid broker: $name" + esac + done + + for name in ${array[@]} + do + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add $name \ + localhost:$MATAHARI_PORT amq.direct &> /dev/null + + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \ + $name amq.direct &> /dev/null + + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add $name \ + localhost:$MATAHARI_PORT qmf.default.direct &> /dev/null + + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \ + $name qmf.default.direct &> /dev/null + + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add $name \ + localhost:$MATAHARI_PORT qmf.default.topic &> /dev/null + + /usr/bin/qpid-route --timeout=$TIMEOUT dynamic add localhost:$MATAHARI_PORT \ + $name qmf.default.topic &> /dev/null + done +} + start() { echo -n $"Starting Matahari broker daemon: " install -o root -g qpidd -m 775 -d @localstatedir@/run/matahari @@ -61,6 +105,9 @@ start() { [ -x /sbin/restorecon ] && /sbin/restorecon $pidfile runuser -s /bin/sh qpidd -c "/usr/sbin/$prog --check > $pidfile" fi + + federate ${FEDERATED_BROKERS[@]} + return $RETVAL }
diff --git a/matahari-broker.sysconf.in b/matahari-broker.sysconf.in index 9b1c2b5..4473610 100644 --- a/matahari-broker.sysconf.in +++ b/matahari-broker.sysconf.in @@ -11,3 +11,11 @@ fi
QPIDD_OPTIONS="--config @sysconfdir@/matahari-broker.conf --port $MATAHARI_PORT"
+# Federated Broker configuration +# Takes the following formats: +# <fqdn>:<port> +# DNS SRV record format "_matahari-broker._tcp" is REQUIRED +# _matahari-broker._tcp.<fqdn> +# +# A mixture of the above is acceptable. +# FEDERATED_BROKERS=("broker1.example.com:49000" "_matahari-broker._tcp.example.com")
matahari@lists.fedorahosted.org