#37 simple_message_to_bus differs from Ansible, is in the wrong place and more problems
Closed 3 years ago by nphilipp. Opened 3 years ago by nphilipp.

Problem Description

There are a couple of issues with the simple_message_to_bus script as it is deployed on log01 and how it's defined in Ansible:

  • it is in the wrong place on log01, in /usr/bin instead of /usr/local/bin as defined – but this /usr/local/bin is missing from PATH in /etc/crontab
  • it is different from what's in the Ansible repo:
nils@makake:~/src/fedora-infra/ansible (main)> scp log01.iad2.fedoraproject.org:/usr/bin/simple_message_to_bus /tmp
simple_message_to_bus                                               100%  836     7.1KB/s   00:00    
nils@makake:~/src/fedora-infra/ansible (main)> diff -u /tmp/simple_message_to_bus roles/fedora-messaging-utils/files/simple_message_to_bus
--- /tmp/simple_message_to_bus  2021-08-18 16:45:31.858983083 +0200
+++ roles/fedora-messaging-utils/files/simple_message_to_bus    2021-08-12 11:57:01.881849876 +0200
@@ -1,12 +1,11 @@
 #!/bin/sh
-LOGHOST="$(hostname)"
-MSGTOPIC_PREFIX="logging.stats"
+MSGTOPIC_PREFIX="${MSGTOPIC_PREFIX:-logging.stats}"
 topic="${MSGTOPIC_PREFIX}.$1"
 shift
 sent_at="$(TZ=UTC date -Iseconds)"
 id="$(uuidgen -r)"
-body="{\"loghost\": \"${LOGHOST}\""
-sep=","
+body="{"
+sep=""

 for body_piece; do
     key_type="${body_piece%%=*}"
@@ -29,4 +28,3 @@
 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
-
nils@makake:~/src/fedora-infra/ansible (main)>

It follows that the version in Ansible still defaults to the logging.stats topic, but is missing the loghost preset in the body. All this needs to be fixed.

Acceptance Criteria

The Ansible repo defines for log01 that:

  • the PATH variable in /etc/crontab contains /usr/local/bin
  • users of simple_message_to_bus set MSGTOPIC_PREFIX explicitly
  • the simple_message_to_bus script
    • allows predefined key/values in message bodies, e.g. by setting an MSGBODY_PRESET environment variable
    • doesn't default to logging.stats for MSGTOPIC_PREFIX
  • the scripts are redeployed
  • the differing copy of simple_message_to_bus is removed

Metadata Update from @nphilipp:
- Issue tagged with: DNF Counting

3 years ago

Metadata Update from @nphilipp:
- Issue assigned to nphilipp

3 years ago

This has been merged, but needs to be deployed still.

Issue status updated to: Closed (was: Open)

3 years ago

Log in to comment on this ticket.

Metadata
Boards 1