Skip to content

Commit

Permalink
Merge pull request #59 from vrdel/pass-nonascii
Browse files Browse the repository at this point in the history
ARGO-2224 Local delivery cache tool should pass non-ascii characters
  • Loading branch information
vrdel authored Feb 6, 2020
2 parents 52b61ca + 6e76459 commit 41f63e8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions init/ams-publisher.service
Original file line number Diff line number Diff line change
@@ -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=multiuser.target
WantedBy=multi-user.target
12 changes: 6 additions & 6 deletions pymod/alarmtoqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions pymod/metrictoqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pymod/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 41f63e8

Please sign in to comment.