aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/config.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2009-07-17 23:29:27 +0000
committerRob Austein <sra@hactrn.net>2009-07-17 23:29:27 +0000
commit3ed1503f0b1bd3a9385a96d949b4579175e2f733 (patch)
treed185cc441b6aef45f64766c896a961992bceb278 /rpkid/rpki/config.py
parent7f4076879fd4cff1e22b44e88e8c896ebe7c18d7 (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.py8
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):