diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-27 01:09:53 -0600 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-10-27 01:09:53 -0600 |
commit | 25a7df9615058372b81a41df6baa2c4692df0063 (patch) | |
tree | 2c9bc5bc5e43bb1ec9e94d6e272e808e94fe4277 | |
parent | 28dd8e74bdefd62307881f6e086af59db97a21a0 (diff) | |
download | freeipa-25a7df9615058372b81a41df6baa2c4692df0063.tar.gz freeipa-25a7df9615058372b81a41df6baa2c4692df0063.tar.xz freeipa-25a7df9615058372b81a41df6baa2c4692df0063.zip |
Env._finalize_core() now also loads config from Env.conf_default
-rw-r--r-- | ipalib/config.py | 2 | ||||
-rw-r--r-- | tests/test_ipalib/test_config.py | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/ipalib/config.py b/ipalib/config.py index 7bb3e072a..538a97a7d 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -203,6 +203,8 @@ class Env(object): self.__doing('_finalize_core') self.__do_if_not_done('_bootstrap') self._merge_config(self.conf) + if self.conf_default != self.conf: + self._merge_config(self.conf_default) if 'in_server' not in self: self.in_server = (self.context == 'server') if 'log' not in self: diff --git a/tests/test_ipalib/test_config.py b/tests/test_ipalib/test_config.py index 0608bf8eb..ddfbb708b 100644 --- a/tests/test_ipalib/test_config.py +++ b/tests/test_ipalib/test_config.py @@ -175,6 +175,14 @@ no = fALse number = 42 """ +# A default config file to make sure it does not overwrite the explicit one +config_default = """ +[global] + +yes = Hello +not_in_other = foo_bar +""" + class test_Env(ClassChecker): """ @@ -328,6 +336,7 @@ class test_Env(ClassChecker): for key in ('yes', 'no', 'number'): assert key not in o home.write(config_good, '.ipa', 'server.conf') + home.write(config_default, '.ipa', 'default.conf') o._finalize_core() assert o.in_tree is True assert o.context == 'server' @@ -336,6 +345,7 @@ class test_Env(ClassChecker): assert o.yes is True assert o.no is False assert o.number == 42 + assert o.not_in_other == 'foo_bar' # Test using DEFAULT_CONFIG: defaults = dict(constants.DEFAULT_CONFIG) |