wsgi, oddjob: remove needless uses of Env

Do not use custom Env instance to determine the debug level to use for the
IPA API object - the IPA API object can properly determine the configured
debug level on its own.

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Jan Cholasta
2016-10-04 14:50:09 +02:00
committed by Martin Basti
parent 227cf8d4e9
commit 0562359f31
3 changed files with 3 additions and 32 deletions

View File

@@ -1,18 +1,7 @@
from ipaplatform.paths import paths from ipaplatform.paths import paths
from ipalib import api from ipalib import api
from ipalib.config import Env
from ipalib.constants import DEFAULT_CONFIG
# Determine what debug level is configured. We can only do this api.bootstrap(context='server', confdir=paths.ETC_IPA, log=None) (ref:wsgi-app-bootstrap)
# by reading in the configuration file(s). The server always reads
# default.conf and will also read in `context'.conf.
env = Env()
env._bootstrap(context='server', log=None, confdir=paths.ETC_IPA)
env._finalize_core(**dict(DEFAULT_CONFIG))
# Initialize the API with the proper debug level
api.bootstrap(context='server', confdir=paths.ETC_IPA,
debug=env.debug, log=None) (ref:wsgi-app-bootstrap)
try: try:
api.finalize() (ref:wsgi-app-finalize) api.finalize() (ref:wsgi-app-finalize)
except Exception as e: except Exception as e:

View File

@@ -5,8 +5,6 @@ from ipaserver.install.installutils import is_ipa_configured, ScriptError
from ipapython import config, ipautil from ipapython import config, ipautil
from ipalib import api from ipalib import api
from ipapython.dn import DN from ipapython.dn import DN
from ipalib.config import Env
from ipalib.constants import DEFAULT_CONFIG
from ipaplatform.constants import constants from ipaplatform.constants import constants
from ipaplatform.paths import paths from ipaplatform.paths import paths
import sys import sys
@@ -91,12 +89,7 @@ if len(args) != 1:
trusted_domain = ipautil.fsdecode(args[0]).lower() trusted_domain = ipautil.fsdecode(args[0]).lower()
env = Env() api.bootstrap(in_server=True, log=None,
env._bootstrap(debug=options.debug, log=None)
env._finalize_core(**dict(DEFAULT_CONFIG))
# Initialize the API with the proper debug level
api.bootstrap(in_server=True, debug=env.debug, log=None,
context='server', confdir=paths.ETC_IPA) context='server', confdir=paths.ETC_IPA)
api.finalize() api.finalize()

View File

@@ -25,19 +25,8 @@ WSGI appliction for IPA server.
""" """
from ipaplatform.paths import paths from ipaplatform.paths import paths
from ipalib import api from ipalib import api
from ipalib.config import Env
from ipalib.constants import DEFAULT_CONFIG
# Determine what debug level is configured. We can only do this api.bootstrap(context='server', confdir=paths.ETC_IPA, log=None)
# by reading in the configuration file(s). The server always reads
# default.conf and will also read in `context'.conf.
env = Env()
env._bootstrap(context='server', log=None, confdir=paths.ETC_IPA)
env._finalize_core(**dict(DEFAULT_CONFIG))
# Initialize the API with the proper debug level
api.bootstrap(context='server', confdir=paths.ETC_IPA,
debug=env.debug, log=None)
try: try:
api.finalize() api.finalize()
except Exception as e: except Exception as e: