diff --git a/ipalib/frontend.py b/ipalib/frontend.py index d918dd833..62a503cc5 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -668,7 +668,7 @@ class Command(plugable.Plugin): on the nearest IPA server and the actual work this command performs is executed remotely. """ - if self.api.env.server_context: + if self.api.env.in_server: target = self.execute else: target = self.forward diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 367211576..594849896 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -29,7 +29,8 @@ import re import inspect import errors from errors import check_type, check_isinstance -from config import Environment +from config import Environment, Env +import constants import util @@ -713,7 +714,7 @@ class API(DictProxy): self.__d = dict() self.__done = set() self.register = Registrar(*allowed) - self.env = Environment() + self.env = Env super(API, self).__init__(self.__d) def __doing(self, name): diff --git a/tests/test_ipalib/test_crud.py b/tests/test_ipalib/test_crud.py index 794921aae..421eaca8b 100644 --- a/tests/test_ipalib/test_crud.py +++ b/tests/test_ipalib/test_crud.py @@ -40,7 +40,7 @@ class CrudChecker(ClassChecker): frontend.Method, frontend.Property, ) - config.set_default_env(api.env) + #config.set_default_env(api.env) class user(frontend.Object): takes_params = ( 'givenname', diff --git a/tests/test_ipalib/test_frontend.py b/tests/test_ipalib/test_frontend.py index 966b5e935..5a678b5bc 100644 --- a/tests/test_ipalib/test_frontend.py +++ b/tests/test_ipalib/test_frontend.py @@ -764,7 +764,8 @@ class test_Command(ClassChecker): # Test in server context: api = plugable.API(self.cls) - api.env.update(dict(server_context=True)) + #api.env.update(dict(server_context=True)) + api.env.in_server = True api.finalize() o = my_cmd() o.set_api(api) @@ -774,7 +775,8 @@ class test_Command(ClassChecker): # Test in non-server context api = plugable.API(self.cls) - api.env.update(dict(server_context=False)) + #api.env.update(dict(server_context=False)) + api.env.in_server = False api.finalize() o = my_cmd() o.set_api(api) @@ -907,7 +909,7 @@ class test_Object(ClassChecker): frontend.Method, frontend.Property, ) - config.set_default_env(api.env) + #config.set_default_env(api.env) api.finalize() # Test with no primary keys: @@ -964,7 +966,7 @@ class test_Object(ClassChecker): frontend.Property, backend.Backend, ) - config.set_default_env(api.env) + #config.set_default_env(api.env) class ldap(backend.Backend): whatever = 'It worked!' api.register(ldap)