summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2011-08-17 15:46:41 +0300
committerRob Crittenden <rcritten@redhat.com>2011-08-17 02:05:13 -0400
commitdca6cf1666f103d94cba2e54cdfe9cac998e98ad (patch)
tree19505c248e322b1bf88e83255761d961ba300c2f /ipalib
parent76a56d07410060cf8047762b8fbee85fc359e9e3 (diff)
downloadfreeipa-dca6cf1666f103d94cba2e54cdfe9cac998e98ad.tar.gz
freeipa-dca6cf1666f103d94cba2e54cdfe9cac998e98ad.tar.xz
freeipa-dca6cf1666f103d94cba2e54cdfe9cac998e98ad.zip
Propagate environment when it is required.
https://fedorahosted.org/freeipa/ticket/1549 https://fedorahosted.org/freeipa/ticket/1550
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/frontend.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index 35343105c..c2ae4e744 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -344,6 +344,13 @@ class HasParam(Plugin):
for spec in get():
param = create_param(spec)
if env is None or param.use_in_context(env):
+ if env is not None and not hasattr(param, 'env'):
+ # Force specified environment. The way it is done is violation of ReadOnly promise.
+ # Unfortunately, all alternatives are worse from both performance and code complexity
+ # points of view. See following threads on freeipa-devel@ for references:
+ # https://www.redhat.com/archives/freeipa-devel/2011-August/msg00000.html
+ # https://www.redhat.com/archives/freeipa-devel/2011-August/msg00011.html
+ object.__setattr__(param, 'env', env)
yield param
def _create_param_namespace(self, name, env=None):