Get rid of implicit message topic prefix
Callers of simple_message_to_bus need to set and export MSGTOPIC_PREFIX explicitly. This decouples the fedora-messaging-utils and web-data-analysis roles. Additionally, don't assume /bin/sh is /bin/bash. Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
8e05661fc5
commit
a3203d29d9
4 changed files with 11 additions and 3 deletions
|
@ -1,6 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
MSGTOPIC_PREFIX="${MSGTOPIC_PREFIX:-logging.stats}"
|
|
||||||
topic="${MSGTOPIC_PREFIX}.$1"
|
# To set a common prefix for all messages, do `export MSGTOPIC_PREFIX=...` in callers.
|
||||||
|
if [ -n "$MSGTOPIC_PREFIX" -a "${MSGTOPIC_PREFIX%.}" = "$MSGTOPIC_PREFIX" ]; then
|
||||||
|
MSGTOPIC_PREFIX="${MSGTOPIC_PREFIX}."
|
||||||
|
fi
|
||||||
|
topic="${MSGTOPIC_PREFIX}$1"
|
||||||
shift
|
shift
|
||||||
sent_at="$(TZ=UTC date -Iseconds)"
|
sent_at="$(TZ=UTC date -Iseconds)"
|
||||||
id="$(uuidgen -r)"
|
id="$(uuidgen -r)"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
# along with Fedora Project Infrastructure Ansible Repository. If
|
# along with Fedora Project Infrastructure Ansible Repository. If
|
||||||
# not, see <http://www.gnu.org/licenses/>.
|
# not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
export MSGTOPIC_PREFIX=logging.stats
|
||||||
RUN_ID="$(uuidgen -r)"
|
RUN_ID="$(uuidgen -r)"
|
||||||
simple_message_to_bus combinehttplogs.start run_id="$RUN_ID"
|
simple_message_to_bus combinehttplogs.start run_id="$RUN_ID"
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
# we are 5 days behind.
|
# we are 5 days behind.
|
||||||
|
|
||||||
# We have dropped this down to 3 days on 2019-10-01
|
# We have dropped this down to 3 days on 2019-10-01
|
||||||
|
|
||||||
|
export MSGTOPIC_PREFIX=logging.stats
|
||||||
RUN_ID="$(uuidgen -r)"
|
RUN_ID="$(uuidgen -r)"
|
||||||
simple_message_to_bus condense-mirrorlogs.start run_id="$RUN_ID"
|
simple_message_to_bus condense-mirrorlogs.start run_id="$RUN_ID"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
export MSGTOPIC_PREFIX=logging.stats
|
||||||
RUN_ID="$(uuidgen -r)"
|
RUN_ID="$(uuidgen -r)"
|
||||||
simple_message_to_bus countme-update.start run_id="$RUN_ID"
|
simple_message_to_bus countme-update.start run_id="$RUN_ID"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue