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
This commit is contained in:
LIU Yulong 2019-03-29 00:16:10 +08:00
parent d03bf63eaa
commit 97923ae4a8
1 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import sys
from neutron_lib import exceptions from neutron_lib import exceptions
from oslo_log import log as logging from oslo_log import log as logging
import six
from neutron._i18n import _ from neutron._i18n import _
@ -136,7 +137,7 @@ class Pidfile(object):
def write(self, pid): def write(self, pid):
os.ftruncate(self.fd, 0) os.ftruncate(self.fd, 0)
os.write(self.fd, b"%d" % pid) os.write(self.fd, six.b("%s" % pid))
os.fsync(self.fd) os.fsync(self.fd)
def read(self): def read(self):