projects
/
dbuscron
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
handle /etc/dbuscrontab.d as well as /etc/dbuscrontab
[dbuscron]
/
dbuscron
/
parser.py
diff --git
a/dbuscron/parser.py
b/dbuscron/parser.py
index
92b2708
..
59f2f4d
100644
(file)
--- a/
dbuscron/parser.py
+++ b/
dbuscron/parser.py
@@
-44,17
+44,23
@@
class CrontabParserError(SyntaxError):
SyntaxError.__init__(self, msg)
SyntaxError.__init__(self, msg)
-def CrontabParser(filename):
- if os.path.isfile(filename):
- parser_class = FileParser
+def CrontabParser(*filenames):
+ for filename in filenames:
+ if not os.path.exists(filename):
+ continue
- elif os.path.isdir(filename):
- parser_class = DirectoryParser
+ if os.path.isfile(filename):
+ parser_class = FileParser
- else:
- raise SystemError("I can parse only directories or simple files.")
+ elif os.path.isdir(filename):
+ parser_class = DirectoryParser
+
+ else:
+ raise SystemError("I can parse only directories or simple files.")
+
+ return parser_class(filename)
- return parser_class(filename)
+ raise SystemError("Can't find any config file or directory.")
class FileParser(object):
__fields_sep = re.compile(r'\s+')
class FileParser(object):
__fields_sep = re.compile(r'\s+')