diff options
author | Rob Austein <sra@hactrn.net> | 2009-07-17 23:29:27 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-07-17 23:29:27 +0000 |
commit | 3ed1503f0b1bd3a9385a96d949b4579175e2f733 (patch) | |
tree | d185cc441b6aef45f64766c896a961992bceb278 /rpkid/rpki/config.py | |
parent | 7f4076879fd4cff1e22b44e88e8c896ebe7c18d7 (diff) |
Ok, some config files really are optional
svn path=/rpkid/rpki/config.py; revision=2637
Diffstat (limited to 'rpkid/rpki/config.py')
-rw-r--r-- | rpkid/rpki/config.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/rpkid/rpki/config.py b/rpkid/rpki/config.py index 67364d21..07f6bfe3 100644 --- a/rpkid/rpki/config.py +++ b/rpkid/rpki/config.py @@ -46,14 +46,18 @@ class parser(object): get-methods with default values and default section name. """ - def __init__(self, filename, section = None): + def __init__(self, filename, section = None, allow_missing = False): """ Initialize this parser. """ self.filename = filename self.cfg = ConfigParser.RawConfigParser() - self.cfg.readfp(open(filename), filename) + try: + self.cfg.readfp(open(filename), filename) + except IOError: + if not allow_missing: + raise self.default_section = section def has_section(self, section): |