summaryrefslogtreecommitdiffstats
path: root/ipalib/config.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-24 15:35:58 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-24 15:35:58 -0600
commit2a41db33c6d9f6efa826e16d91eba76defe899d2 (patch)
tree6beb3d8936b23b6a0c60189631aa5082b3710e8e /ipalib/config.py
parent39dfffd280bb9df257a57c31ca185bc88dfc4bd5 (diff)
downloadfreeipa-2a41db33c6d9f6efa826e16d91eba76defe899d2.tar.gz
freeipa-2a41db33c6d9f6efa826e16d91eba76defe899d2.tar.xz
freeipa-2a41db33c6d9f6efa826e16d91eba76defe899d2.zip
Env._bootstrap() now raises StandardError if called more than once
Diffstat (limited to 'ipalib/config.py')
-rw-r--r--ipalib/config.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/ipalib/config.py b/ipalib/config.py
index 86d8f1da7..dd00d713f 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -137,6 +137,7 @@ class Env(object):
def __init__(self):
object.__setattr__(self, '_Env__d', {})
+ object.__setattr__(self, '_Env__done', set())
self.ipalib = path.dirname(path.abspath(__file__))
self.site_packages = path.dirname(self.ipalib)
self.script = path.abspath(sys.argv[0])
@@ -144,6 +145,13 @@ class Env(object):
self.home = path.abspath(os.environ['HOME'])
self.dot_ipa = path.join(self.home, '.ipa')
+ def __do(self, name):
+ if name in self.__done:
+ raise StandardError(
+ '%s.%s() already called' % (self.__class__.__name__, name)
+ )
+ self.__done.add(name)
+
def _bootstrap(self, **overrides):
"""
Initialize basic environment.
@@ -154,6 +162,7 @@ class Env(object):
This method should be called before any plugins are loaded.
"""
+ self.__do('_bootstrap')
for (key, value) in overrides.items():
self[key] = value
if 'in_tree' not in self: