mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Env._bootstrap() now also sets Env.conf_default
This commit is contained in:
@@ -178,12 +178,14 @@ class Env(object):
|
|||||||
self.in_tree = False
|
self.in_tree = False
|
||||||
if 'context' not in self:
|
if 'context' not in self:
|
||||||
self.context = 'default'
|
self.context = 'default'
|
||||||
|
if self.in_tree:
|
||||||
|
base = self.dot_ipa
|
||||||
|
else:
|
||||||
|
base = path.join('/', 'etc', 'ipa')
|
||||||
if 'conf' not in self:
|
if 'conf' not in self:
|
||||||
name = '%s.conf' % self.context
|
self.conf = path.join(base, '%s.conf' % self.context)
|
||||||
if self.in_tree:
|
if 'conf_default' not in self:
|
||||||
self.conf = path.join(self.dot_ipa, name)
|
self.conf_default = path.join(base, 'default.conf')
|
||||||
else:
|
|
||||||
self.conf = path.join('/', 'etc', 'ipa', name)
|
|
||||||
|
|
||||||
def _finalize_core(self, **defaults):
|
def _finalize_core(self, **defaults):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -79,7 +79,8 @@ DEFAULT_CONFIG = (
|
|||||||
# Set in Env._bootstrap():
|
# Set in Env._bootstrap():
|
||||||
('in_tree', None), # Whether or not running in-tree (bool)
|
('in_tree', None), # Whether or not running in-tree (bool)
|
||||||
('context', None), # Name of context, default is 'default'
|
('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():
|
# Set in Env._finalize_core():
|
||||||
('in_server', None), # Whether or not running in-server (bool)
|
('in_server', None), # Whether or not running in-server (bool)
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ class test_Env(ClassChecker):
|
|||||||
assert o.in_tree is False
|
assert o.in_tree is False
|
||||||
assert o.context == 'default'
|
assert o.context == 'default'
|
||||||
assert o.conf == '/etc/ipa/default.conf'
|
assert o.conf == '/etc/ipa/default.conf'
|
||||||
|
assert o.conf_default == o.conf
|
||||||
|
|
||||||
# Test overriding values created by _bootstrap()
|
# Test overriding values created by _bootstrap()
|
||||||
(o, home) = self.bootstrap(in_tree='true', context='server')
|
(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.in_tree is False
|
||||||
assert o.context == 'default'
|
assert o.context == 'default'
|
||||||
assert o.conf == '/my/wacky/whatever.conf'
|
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
|
# Test various overrides and types conversion
|
||||||
kw = dict(
|
kw = dict(
|
||||||
|
|||||||
Reference in New Issue
Block a user