summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2014-03-05 13:59:10 +0100
committerPetr Viktorin <pviktori@redhat.com>2014-03-05 19:57:37 +0100
commit5ae737e160ccdd2c4b545b3cf2c6737d126dba61 (patch)
tree49cf00cba8e60942d350794e535bda4b3d1ea05a
parent6b94f959a4d41b62ca6c2b273633880bbfab8b49 (diff)
downloadfreeipa-5ae737e160ccdd2c4b545b3cf2c6737d126dba61.tar.gz
freeipa-5ae737e160ccdd2c4b545b3cf2c6737d126dba61.tar.xz
freeipa-5ae737e160ccdd2c4b545b3cf2c6737d126dba61.zip
ipalib.plugable: Always set the parser in bootstrap()
In cases where logging was already configured by the time API.bootstrap() was called, saving the argument parser was mistakenly skipped along with the logging configuration. Always set the argument parser on the API object. Reviewed-By: Jan Cholasta <jcholast@redhat.com>
-rw-r--r--ipalib/plugable.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 3be8bb118..216f9c08a 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -493,6 +493,12 @@ class API(DictProxy):
object.__setattr__(self, 'log_mgr', log_mgr)
log = log_mgr.root_logger
object.__setattr__(self, 'log', log)
+
+ # Add the argument parser
+ if not parser:
+ parser = self.build_global_parser()
+ object.__setattr__(self, 'parser', parser)
+
# If logging has already been configured somewhere else (like in the
# installer), don't add handlers or change levels:
if log_mgr.configure_state != 'default' or self.env.validate_api:
@@ -518,10 +524,6 @@ class API(DictProxy):
level=level,
format=LOGGING_FORMAT_STDERR)])
- if not parser:
- parser = self.build_global_parser()
- object.__setattr__(self, 'parser', parser)
-
# Add file handler:
if self.env.mode in ('dummy', 'unit_test'):
return # But not if in unit-test mode