else:
return False
- def acquire_portlock(self, lockfile, error=True):
+ def acquire_portlock(self, lockfile):
logger.debug("Acquiring lockfile %s..." % lockfile)
try:
portlock_descriptor = open(lockfile, 'w')
fcntl.flock(self.portlocks[lockfile], fcntl.LOCK_EX|fcntl.LOCK_NB)
except Exception as e:
msg = "Acquiring lockfile %s failed: %s" % (lockfile, e)
- if error:
- logger.error(msg)
- else:
- logger.info(msg)
- if self.portlocks[lockfile]:
+ logger.info(msg)
+ if lockfile in self.portlocks.keys() and self.portlocks[lockfile]:
self.portlocks[lockfile].close()
del self.portlocks[lockfile]
return False