]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/zabbix: talk to zabbix_sender in text not bytes
authorKefu Chai <kchai@redhat.com>
Wed, 27 Jan 2021 04:52:10 +0000 (12:52 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 27 Jan 2021 11:22:05 +0000 (19:22 +0800)
as we expect read from / write to it in text mode.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/zabbix/module.py

index 37f8b9ba39e8d064ef59db615b8401fcea50c6ee..c16b98cfb10bea976d1e4032b3eea787810ab4eb 100644 (file)
@@ -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: