diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-27 00:58:25 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-27 00:58:25 -0600 |
commit | 28dd8e74bdefd62307881f6e086af59db97a21a0 (patch) | |
tree | ee2eb935d5e07bfa867374ce65d1af9804bf839d | |
parent | c8b3f6516513dc3e5948fe8280c3f159ad122684 (diff) | |
download | freeipa-28dd8e74bdefd62307881f6e086af59db97a21a0.tar.gz freeipa-28dd8e74bdefd62307881f6e086af59db97a21a0.tar.xz freeipa-28dd8e74bdefd62307881f6e086af59db97a21a0.zip |
Env._bootstrap() now also sets Env.conf_default
-rw-r--r-- | ipalib/config.py | 12 | ||||
-rw-r--r-- | ipalib/constants.py | 3 | ||||
-rw-r--r-- | tests/test_ipalib/test_config.py | 7 |
3 files changed, 16 insertions, 6 deletions
diff --git a/ipalib/config.py b/ipalib/config.py index 71d3024c..7bb3e072 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -178,12 +178,14 @@ class Env(object): self.in_tree = False if 'context' not in self: self.context = 'default' + if self.in_tree: + base = self.dot_ipa + else: + base = path.join('/', 'etc', 'ipa') if 'conf' not in self: - name = '%s.conf' % self.context - if self.in_tree: - self.conf = path.join(self.dot_ipa, name) - else: - self.conf = path.join('/', 'etc', 'ipa', name) + self.conf = path.join(base, '%s.conf' % self.context) + if 'conf_default' not in self: + self.conf_default = path.join(base, 'default.conf') def _finalize_core(self, **defaults): """ diff --git a/ipalib/constants.py b/ipalib/constants.py index e7b370f1..4942cc9b 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -79,7 +79,8 @@ DEFAULT_CONFIG = ( # Set in Env._bootstrap(): ('in_tree', None), # Whether or not running in-tree (bool) ('context', None), # Name of context, default is 'default' - ('conf', None), # Path to configuration file + ('conf', None), # Path to config file + ('conf_default', None), # Path to common default config file # Set in Env._finalize_core(): ('in_server', None), # Whether or not running in-server (bool) diff --git a/tests/test_ipalib/test_config.py b/tests/test_ipalib/test_config.py index 6136bdf0..0608bf8e 100644 --- a/tests/test_ipalib/test_config.py +++ b/tests/test_ipalib/test_config.py @@ -227,6 +227,7 @@ class test_Env(ClassChecker): assert o.in_tree is False assert o.context == 'default' assert o.conf == '/etc/ipa/default.conf' + assert o.conf_default == o.conf # Test overriding values created by _bootstrap() (o, home) = self.bootstrap(in_tree='true', context='server') @@ -237,6 +238,12 @@ class test_Env(ClassChecker): assert o.in_tree is False assert o.context == 'default' assert o.conf == '/my/wacky/whatever.conf' + assert o.conf_default == '/etc/ipa/default.conf' + (o, home) = self.bootstrap(conf_default='/my/wacky/default.conf') + assert o.in_tree is False + assert o.context == 'default' + assert o.conf == '/etc/ipa/default.conf' + assert o.conf_default == '/my/wacky/default.conf' # Test various overrides and types conversion kw = dict( |