Use bytes for python3 friendly os.write
Bytes not str. Otherwise we get
TypeError: a bytes-like object is required, not 'str'
in the metadata proxy and it dies.
Closes-Bug: #1661303
Change-Id: If6b6f19130c965436a637a03a4cf72203e0786b0
(cherry picked from commit 33129f2ac6
)
This commit is contained in:
parent
87824370fc
commit
fc605900f7
@ -136,7 +136,7 @@ class Pidfile(object):
|
||||
|
||||
def write(self, pid):
|
||||
os.ftruncate(self.fd, 0)
|
||||
os.write(self.fd, "%d" % pid)
|
||||
os.write(self.fd, b"%d" % pid)
|
||||
os.fsync(self.fd)
|
||||
|
||||
def read(self):
|
||||
|
@ -180,7 +180,7 @@ class TestPidfile(base.BaseTestCase):
|
||||
|
||||
self.os.assert_has_calls([
|
||||
mock.call.ftruncate(FAKE_FD, 0),
|
||||
mock.call.write(FAKE_FD, '34'),
|
||||
mock.call.write(FAKE_FD, b'34'),
|
||||
mock.call.fsync(FAKE_FD)]
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user