gcron: catch OSError as well as IOError
In case os.open() fails because the file does not exist, an OSError is raised. To prevent the script to abort uncleanly, catch the OSError in addition to the IOError. Change-Id: I48e5b23e17d63639cc33db51b4229249a9887880 Fixes: bz#1590193 Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
6ac82e8306
commit
26b52694fe
@ -105,10 +105,10 @@ def doJob(name, lockFile, jobFunc, volname):
|
||||
else:
|
||||
log.info("Job %s has been processed already", name)
|
||||
fcntl.flock(f, fcntl.LOCK_UN)
|
||||
except IOError as (errno, strerror):
|
||||
except (OSError, IOError) as (errno, strerror):
|
||||
log.info("Job %s is being processed by another agent", name)
|
||||
os.close(f)
|
||||
except IOError as (errno, strerror):
|
||||
except (OSError, IOError) as (errno, strerror):
|
||||
log.debug("Failed to open lock file %s : %s", lockFile, strerror)
|
||||
log.error("Failed to process job %s", name)
|
||||
success = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user