1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 14:16:00 +00:00

fixed non-ascii characters inside petition title wheh running inside Munin

This commit is contained in:
Raphaël Droz 2017-01-05 03:11:29 -03:00
parent 4804aea0ec
commit 97d4922ba7

View file

@ -28,6 +28,8 @@ GPLv3
''' '''
from sys import argv, exit from sys import argv, exit
import sys
import codecs
from os import environ, path, umask from os import environ, path, umask
import re import re
import urllib.request import urllib.request
@ -74,6 +76,8 @@ if environ.get('MUNIN_PLUGSTATE') and write_cache:
with open(petition_cache_names, 'w') as outfile: with open(petition_cache_names, 'w') as outfile:
json.dump(petition_titles, outfile) json.dump(petition_titles, outfile)
# equivalent of passing PYTHONIOENCODING=utf-8 to munin
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())
if len(argv) > 1 and argv[1] == 'config': if len(argv) > 1 and argv[1] == 'config':
print('''graph_title change.org signature count print('''graph_title change.org signature count