Merge pull request #5 from axinojolais/fix_locking
fix g-s-s.py locking : only remove the lockfile if we have the lock
This commit is contained in:
commit
1c82b34c98
|
@ -454,7 +454,6 @@ def main():
|
||||||
log.info("glance-simplestreams-sync started.")
|
log.info("glance-simplestreams-sync started.")
|
||||||
|
|
||||||
lockfile = open(SYNC_RUNNING_FLAG_FILE_NAME, 'w')
|
lockfile = open(SYNC_RUNNING_FLAG_FILE_NAME, 'w')
|
||||||
atexit.register(cleanup)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
fcntl.flock(lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
||||||
|
@ -462,6 +461,7 @@ def main():
|
||||||
log.info("{} is locked, exiting".format(SYNC_RUNNING_FLAG_FILE_NAME))
|
log.info("{} is locked, exiting".format(SYNC_RUNNING_FLAG_FILE_NAME))
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
atexit.register(cleanup)
|
||||||
lockfile.write(str(os.getpid()))
|
lockfile.write(str(os.getpid()))
|
||||||
|
|
||||||
id_conf, charm_conf = get_conf()
|
id_conf, charm_conf = get_conf()
|
||||||
|
|
Loading…
Reference in New Issue