From: Cedric Brandily Date: Wed, 8 Jul 2015 15:38:37 +0000 (+0000) Subject: Correct fcntl.flock use in Pidfile.unlock X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=324787c0b4bf6b8208c781a4c79dc7f14e67d8d6;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/agent/linux/daemon.py b/neutron/agent/linux/daemon.py index b4c7853b5..5d0abce62 100644 --- a/neutron/agent/linux/daemon.py +++ b/neutron/agent/linux/daemon.py @@ -121,8 +121,7 @@ class Pidfile(object): return self.pidfile def unlock(self): - if not not fcntl.flock(self.fd, fcntl.LOCK_UN): - raise IOError(_('Unable to unlock pid file')) + fcntl.flock(self.fd, fcntl.LOCK_UN) def write(self, pid): os.ftruncate(self.fd, 0)