Skip to content

Commit

Permalink
same for alarms - no encode/decode
Browse files Browse the repository at this point in the history
  • Loading branch information
vrdel committed Feb 6, 2020
1 parent 4f644c1 commit 6e76459
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 6e76459

Please sign in to comment.