Make scripts to sync log files more robust
Previously, an expired certificate on log01 made sending messages out of the scripts fail, which caused a couple days worth of lost logs. Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
parent
85a53986e6
commit
a95808355c
2 changed files with 11 additions and 2 deletions
|
@ -1,5 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
# This scripts is used to send messages to the Fedora message bus. It will catch problems with
|
||||
# actually sending the underlying message so that other scripts using it continue regardless.
|
||||
|
||||
set +e
|
||||
|
||||
# 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}."
|
||||
|
@ -31,6 +37,6 @@ for body_piece in $MSGBODY_PRESET "$@"; do
|
|||
done
|
||||
body="${body}}"
|
||||
|
||||
fedora-messaging publish - << EOF >/dev/null
|
||||
fedora-messaging publish - << EOF >/dev/null || :
|
||||
{"body": ${body}, "headers": {"fedora_messaging_schema": "base.message", "fedora_messaging_severity": 20, "sent-at": "${sent_at}"}, "id": "${id}", "queue": "queue", "topic": "${topic}"}
|
||||
EOF
|
||||
|
|
|
@ -37,7 +37,10 @@ log = logging.getLogger(__name__)
|
|||
|
||||
def send_bus_msg(topic, **kwargs):
|
||||
msg = message.Message(topic=f"{MSGTOPIC_PREFIX}.{topic}", body=kwargs)
|
||||
api.publish(msg)
|
||||
try:
|
||||
api.publish(msg)
|
||||
except Exception as exc:
|
||||
log.warning("Can’t send message to the bus: %s, %s", msg, exc)
|
||||
|
||||
|
||||
def send_sync_msg(topic, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue