Module: check_mk
Branch: master
Commit: 2925b76af056dee608ac1cf6a1c737f181b8faab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2925b76af056de…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 14 16:43:03 2013 +0100
Fixed exception in case of non existing rowselection directory
---
web/htdocs/weblib.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/web/htdocs/weblib.py b/web/htdocs/weblib.py
index b36874a..e2db673 100644
--- a/web/htdocs/weblib.py
+++ b/web/htdocs/weblib.py
@@ -104,11 +104,14 @@ def cleanup_old_selections():
# the current time and delete the selection file when it is older than
# the livetime.
path = config.user_confdir + '/rowselection'
- for f in os.listdir(path):
- if f[1] != '.' and f.endswith('.mk'):
- p = path + '/' + f
- if time.time() - os.stat(p).st_mtime > config.selection_livetime:
- os.unlink(p)
+ try:
+ for f in os.listdir(path):
+ if f[1] != '.' and f.endswith('.mk'):
+ p = path + '/' + f
+ if time.time() - os.stat(p).st_mtime > config.selection_livetime:
+ os.unlink(p)
+ except OSError:
+ pass # no directory -> no cleanup
# Generates a selection id or uses the given one
def selection_id():