From: Kefu Chai Date: Wed, 27 Jan 2021 04:52:10 +0000 (+0800) Subject: mgr/zabbix: talk to zabbix_sender in text not bytes X-Git-Tag: v17.1.0~3148^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5cafe02168c5ccd18dac9dbfe493cc6b73dd206d;p=ceph.git mgr/zabbix: talk to zabbix_sender in text not bytes as we expect read from / write to it in text mode. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/mgr/zabbix/module.py b/src/pybind/mgr/zabbix/module.py index 37f8b9ba39e8..c16b98cfb10b 100644 --- a/src/pybind/mgr/zabbix/module.py +++ b/src/pybind/mgr/zabbix/module.py @@ -37,11 +37,11 @@ class ZabbixSender(object): self.log.debug('Executing: %s', cmd) - proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) + proc = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE, encoding='utf-8') for key, value in data.items(): assert proc.stdin - proc.stdin.write('{0} ceph.{1} {2}\n'.format(hostname, key, value).encode('utf-8')) + proc.stdin.write('{0} ceph.{1} {2}\n'.format(hostname, key, value)) stdout, stderr = proc.communicate() if proc.returncode != 0: