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:
Ryan Beisner 2018-05-08 12:12:48 -05:00 committed by GitHub
commit 1c82b34c98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -454,7 +454,6 @@ def main():
log.info("glance-simplestreams-sync started.")
lockfile = open(SYNC_RUNNING_FLAG_FILE_NAME, 'w')
atexit.register(cleanup)
try:
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))
sys.exit(0)
atexit.register(cleanup)
lockfile.write(str(os.getpid()))
id_conf, charm_conf = get_conf()