7 class ConfigError(Exception):
11 def read_config(filename):
12 parser = ConfigParser.ConfigParser()
13 if not parser.read(filename):
14 raise ConfigError('File not found: %s' % filename)
15 root_dir = os.path.dirname(os.path.abspath(filename))
17 if parser.has_section('global'):
18 global_config = dict(parser.items('global'))
19 root_dir = global_config.get('root_dir', root_dir)
20 ca_obj = ca.CA(root_dir, dict(parser.items('ca')))
22 for section in parser.sections():
23 if section in ('ca', 'global'):
25 certs.append(cert.Cert(ca_obj, section, dict(parser.items(section))))
26 return global_config, ca_obj, certs