aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Elkins <melkins@tislabs.com>2013-09-23 16:24:30 +0000
committerMichael Elkins <melkins@tislabs.com>2013-09-23 16:24:30 +0000
commitde1827f6dc6c171c0dc6887f3ba871e0f77211fa (patch)
treed1429b2ca1cf386dcc70b8278e551761d4d23126
parent9422b66024d89d0cb48b3f18595517b151a93818 (diff)
catch OSError when calling os.stat() and treat the object as if it were missing from rcynic.xml
see #625 svn path=/trunk/; revision=5512
-rw-r--r--rpkid/rpki/gui/cacheview/util.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/rpkid/rpki/gui/cacheview/util.py b/rpkid/rpki/gui/cacheview/util.py
index de683e98..0e6e0973 100644
--- a/rpkid/rpki/gui/cacheview/util.py
+++ b/rpkid/rpki/gui/cacheview/util.py
@@ -177,8 +177,16 @@ def save_statuses(statuses):
else:
inst = inst_qs[0]
- # determine if the object is changed/new
- mtime = os.stat(vs.filename)[stat.ST_MTIME]
+ try:
+ # determine if the object is changed/new
+ mtime = os.stat(vs.filename)[stat.ST_MTIME]
+ except OSError as e:
+ logger.error('unable to stat %s: %s %s' % (
+ vs.filename, type(e), e))
+ # treat as if missing from rcynic.xml
+ inst.delete()
+ return
+
if mtime != inst.mtime:
inst.mtime = mtime
try: