Correct fcntl.flock use in Pidfile.unlock

This change corrects Pidfile.unlock[1] implementation, indeed currently
it uses fcntl.flock response as a condition but fcntl.flock is a "void"
function.

[1] neutron.agent.linux.daemon

Closes-Bug: #1472725
Change-Id: If2320f29095ed388f9f6fe59d4d9b80d04adaa85
This commit is contained in:
Cedric Brandily 2015-07-08 15:38:37 +00:00
parent ed4fb282d2
commit 324787c0b4

View File

@ -121,8 +121,7 @@ class Pidfile(object):
return self.pidfile return self.pidfile
def unlock(self): def unlock(self):
if not not fcntl.flock(self.fd, fcntl.LOCK_UN): fcntl.flock(self.fd, fcntl.LOCK_UN)
raise IOError(_('Unable to unlock pid file'))
def write(self, pid): def write(self, pid):
os.ftruncate(self.fd, 0) os.ftruncate(self.fd, 0)