diff options
-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) |