From 3ef17ac6730e8c91159e537ea35666f8135f483a Mon Sep 17 00:00:00 2001 From: Daniel Vrcic Date: Thu, 6 Feb 2020 19:46:47 +0100 Subject: [PATCH 1/4] just pass the value - do not try to encode/decode them --- pymod/metrictoqueue.py | 14 +++++++------- pymod/publish.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pymod/metrictoqueue.py b/pymod/metrictoqueue.py index 0f4c909..9e512e1 100644 --- a/pymod/metrictoqueue.py +++ b/pymod/metrictoqueue.py @@ -30,15 +30,15 @@ def build_msg(args, *headers): timestamp, service, hostname, metric, status, nagioshost = headers - msg.header.update({'timestamp': timestamp.encode('utf-8')}) - msg.header.update({'service': service.encode('utf-8')}) - msg.header.update({'hostname': hostname.encode('utf-8')}) - msg.header.update({'metric': metric.encode('utf-8')}) - msg.header.update({'status': status.encode('utf-8')}) - msg.header.update({'monitoring_host': nagioshost.encode('utf-8')}) + msg.header.update({'timestamp': timestamp}) + msg.header.update({'service': service}) + msg.header.update({'hostname': hostname}) + msg.header.update({'metric': metric}) + msg.header.update({'status': status}) + msg.header.update({'monitoring_host': nagioshost}) for bs in ['summary', 'message', 'vofqan', 'voname', 'roc', 'actual_data', 'site']: - code = "msg.body += '%s: ' + args.%s.encode(\'utf-8\') + '\\n' if args.%s else ''" % (bs, bs, bs) + code = "msg.body += '%s: ' + args.%s + '\\n' if args.%s else ''" % (bs, bs, bs) exec code msg.text = True diff --git a/pymod/publish.py b/pymod/publish.py index 16ab165..ea55b9a 100644 --- a/pymod/publish.py +++ b/pymod/publish.py @@ -127,7 +127,7 @@ def _extract_body(self, body, fields, maps=None): if maps and key in maps: key = maps[key] - msg[key] = value.decode('utf-8', 'replace') + msg[key] = value return msg From 4f644c1448066d960ea5d2db967777edbfcf0c87 Mon Sep 17 00:00:00 2001 From: Daniel Vrcic Date: Thu, 6 Feb 2020 20:12:36 +0100 Subject: [PATCH 2/4] fix non-ascii chars in unit --- init/ams-publisher.service | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init/ams-publisher.service b/init/ams-publisher.service index b21235b..a628f1d 100644 --- a/init/ams-publisher.service +++ b/init/ams-publisher.service @@ -1,11 +1,11 @@ [Unit] -Description=AMS publisher +Description=AMS publisher After=network.target [Service] Type=simple -ExecStart=/usr/bin/ams-publisherd -d start -ExecStop=/usr/bin/ams-publisherd -d stop +ExecStart=/usr/bin/ams-publisherd -d start +ExecStop=/usr/bin/ams-publisherd -d stop [Install] -WantedBy=multiāˆ’user.target +WantedBy=multi-user.target From 6e7645948d8352312b4381247ed1d0cfb031c703 Mon Sep 17 00:00:00 2001 From: Daniel Vrcic Date: Thu, 6 Feb 2020 20:31:19 +0100 Subject: [PATCH 3/4] same for alarms - no encode/decode --- pymod/alarmtoqueue.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pymod/alarmtoqueue.py b/pymod/alarmtoqueue.py index 888cc78..83409c8 100644 --- a/pymod/alarmtoqueue.py +++ b/pymod/alarmtoqueue.py @@ -28,14 +28,14 @@ def build_msg(args, *headers): timestamp, service, hostname, testname, status, nagioshost = headers - msg.header.update({'execution_time': timestamp.encode('utf-8')}) - msg.header.update({'service_flavour': service.encode('utf-8')}) - msg.header.update({'node_name': hostname.encode('utf-8')}) - msg.header.update({'test_name': testname.encode('utf-8')}) - msg.header.update({'status': status.encode('utf-8')}) + msg.header.update({'execution_time': timestamp}) + msg.header.update({'service_flavour': service}) + msg.header.update({'node_name': hostname}) + msg.header.update({'test_name': testname}) + msg.header.update({'status': status}) for bs in ['details', 'vo', 'site', 'roc', 'urlhistory', 'urlhelp']: - code = "msg.body += '%s: ' + args.%s.encode(\'utf-8\') + '\\n' if args.%s else ''" % (bs, bs, bs) + code = "msg.body += '%s: ' + args.%s + '\\n' if args.%s else ''" % (bs, bs, bs) exec code msg.text = True From 1347c0f5c7ef31323df69b20fcf7e472f33d78b3 Mon Sep 17 00:00:00 2001 From: Daniel Vrcic Date: Tue, 31 Mar 2020 14:22:45 +0200 Subject: [PATCH 4/4] version bump --- argo-nagios-ams-publisher.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/argo-nagios-ams-publisher.spec b/argo-nagios-ams-publisher.spec index ec286b8..cfce8c5 100644 --- a/argo-nagios-ams-publisher.spec +++ b/argo-nagios-ams-publisher.spec @@ -10,8 +10,8 @@ %endif Name: argo-nagios-ams-publisher -Version: 0.3.5 -Release: 2%{mydist} +Version: 0.3.6 +Release: 1%{mydist} Summary: Bridge from Nagios to the ARGO Messaging system Group: Network/Monitoring @@ -109,6 +109,8 @@ if ! /usr/bin/getent group nagiocmd &>/dev/null; then fi %changelog +* Tue Mar 31 2020 Daniel Vrcic - 0.3.6-1%{?dist} +- ARGO-2224 Local delivery cache tool should pass non-ascii characters * Tue Apr 23 2019 Daniel Vrcic - 0.3.5-2%{?dist} - regression fix to include site name in `site` field of notification * Wed Apr 17 2019 Daniel Vrcic - 0.3.5-1%{?dist}