diff options
| author | Simo Sorce <simo@redhat.com> | 2015-05-26 17:00:48 -0400 |
|---|---|---|
| committer | Simo Sorce <simo@redhat.com> | 2015-05-26 17:00:48 -0400 |
| commit | 0050d9d6e7dadfbceb1dd684fea74710d694fd61 (patch) | |
| tree | 15fdae5adbb7e9abbf6b888917219d43a90065e5 | |
| parent | 3312c70e87f4137dba3ec2175e9f90b69b918246 (diff) | |
List special configuration names in one place
This way checks and hives are created from the same list and will not
get out of sync (they are before this commit).
Signed-off-by: Simo Sorce <simo@redhat.com>
| -rwxr-xr-x | custodia/custodia | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/custodia/custodia b/custodia/custodia index 2c1ccd1..0fd621b 100755 --- a/custodia/custodia +++ b/custodia/custodia @@ -35,6 +35,8 @@ def attach_store(typename, plugins, stores): raise ValueError('[%s%s] references unexisting store ' '"%s"' % (typename, name, c.store_name)) +CONFIG_SPECIALS = ['authenticators', 'authorizers', 'consumers', 'stores'] + def parse_config(cfgfile): parser = RawConfigParser() parser.optionxform = str @@ -42,12 +44,13 @@ def parse_config(cfgfile): if len(files) == 0: raise IOError("Failed to read config file") - config = {'authenticators': dict(), 'authorizers': dict(), - 'consumers': dict(), 'stores': dict()} + config = dict() + for s in CONFIG_SPECIALS: + config[s] = dict() for s in parser.sections(): if s == 'global': for opt, val in parser.items(s): - if opt == 'consumers' or opt == 'authenticators': + if opt in CONFIG_SPECIALS: raise ValueError('"%s" is an invalid ' '[global] option' % opt) config[opt] = val |
