]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Correct fcntl.flock use in Pidfile.unlock
authorCedric Brandily <zzelle@gmail.com>
Wed, 8 Jul 2015 15:38:37 +0000 (15:38 +0000)
committerCedric Brandily <zzelle@gmail.com>
Thu, 9 Jul 2015 07:54:38 +0000 (09:54 +0200)
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

neutron/agent/linux/daemon.py

index b4c7853b54a7327fbac63cf28db2ff7a5e9ee6a7..5d0abce62b8b0de47a736eced2655a7ce3c442d8 100644 (file)
@@ -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)