From 97923ae4a89217f90417d2561a1366e8aacd7f25 Mon Sep 17 00:00:00 2001 From: LIU Yulong Date: Fri, 29 Mar 2019 00:16:10 +0800 Subject: [PATCH] Convert int to bytes for py3 The following error raised during the functional test: "TypeError: unsupported operand type(s) for %: 'bytes' and 'int'" This patch converts the string to bytes for py3. Closes-Bug: #1822155 Change-Id: I3de92ef830e5f424aa83b57d8ed843a7c4349e8a --- neutron/agent/linux/daemon.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neutron/agent/linux/daemon.py b/neutron/agent/linux/daemon.py index cd81ae525fe..223bc1e9316 100644 --- a/neutron/agent/linux/daemon.py +++ b/neutron/agent/linux/daemon.py @@ -24,6 +24,7 @@ import sys from neutron_lib import exceptions from oslo_log import log as logging +import six from neutron._i18n import _ @@ -136,7 +137,7 @@ class Pidfile(object): def write(self, pid): os.ftruncate(self.fd, 0) - os.write(self.fd, b"%d" % pid) + os.write(self.fd, six.b("%s" % pid)) os.fsync(self.fd) def read(self):