From 1dd7b11b0b5697f86f4d486fbe9509484ae2065a Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 3 Jun 2010 17:07:24 -0400 Subject: Connect the -v cli argument to the verbose flag in xmlrpclib If you pass two -v to the ipa command you'll get the XML-RPC data in the output. This can be handy so you know exactly what went out over the wire. --- ipa.1 | 7 +++++-- ipalib/backend.py | 2 +- ipalib/constants.py | 2 +- ipalib/plugable.py | 6 +++--- ipalib/rpc.py | 4 ++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ipa.1 b/ipa.1 index 471572467..67a123756 100644 --- a/ipa.1 +++ b/ipa.1 @@ -49,8 +49,11 @@ Display a help message with a list of options. \fB\-n\fR, \fB\-\-no\-prompt\fR Don't prompt for any parameters of \fBCOMMAND\fR, even if they are required. .TP -\fB\-v\fR, \fB\-\-prompt\-all\fR -Produce verbose output. +\fB\-a\fR, \fB\-\-prompt\-all\fR +Prompt for ALL values (even if optional) +.TP +\fB\-v\fR, \fB\-\-verbose\fR +Produce verbose output. A second \-v displays the XML\-RPC request .SH "COMMANDS" The principal function of the CLI is to execute administrative commands specified by the \fICOMMAND\fR argument. The majority of commands are executed remotely over XML\-RPC on a IPA server listed in the configuration file (see FILES section of this manual page). diff --git a/ipalib/backend.py b/ipalib/backend.py index 03f4ce396..b17c517ab 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -109,7 +109,7 @@ class Executioner(Backend): if self.env.in_server: self.Backend.ldap2.connect(ccache=ccache) else: - self.Backend.xmlclient.connect() + self.Backend.xmlclient.connect(verbose=(self.env.verbose >= 2)) if client_ip is not None: setattr(context, "client_ip", client_ip) diff --git a/ipalib/constants.py b/ipalib/constants.py index 02d9f6f7b..05fa1e667 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -118,7 +118,7 @@ DEFAULT_CONFIG = ( ('webui_assets_dir', None), # Debugging: - ('verbose', False), + ('verbose', 0), ('debug', False), ('mode', 'production'), diff --git a/ipalib/plugable.py b/ipalib/plugable.py index ded762d19..397004eb1 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -397,7 +397,7 @@ class API(DictProxy): stderr = logging.StreamHandler() if self.env.debug: stderr.setLevel(logging.DEBUG) - elif self.env.verbose: + elif self.env.verbose > 0: stderr.setLevel(logging.INFO) else: stderr.setLevel(logging.WARNING) @@ -444,8 +444,8 @@ class API(DictProxy): parser.add_option('-d', '--debug', action='store_true', help='Produce full debuging output', ) - parser.add_option('-v', '--verbose', action='store_true', - help='Produce more verbose output', + parser.add_option('-v', '--verbose', action='count', + help='Produce more verbose output. A second -v displays the XML-RPC request', ) if context == 'cli': parser.add_option('-a', '--prompt-all', action='store_true', diff --git a/ipalib/rpc.py b/ipalib/rpc.py index e7f333848..f9067d1bd 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -374,11 +374,11 @@ class xmlclient(Connectible): super(xmlclient, self).__init__() self.__errors = dict((e.errno, e) for e in public_errors) - def create_connection(self, ccache=None): + def create_connection(self, ccache=None, verbose=False): kw = dict(allow_none=True, encoding='UTF-8') if self.env.xmlrpc_uri.startswith('https://'): kw['transport'] = KerbTransport() - kw['verbose'] = False + kw['verbose'] = verbose return ServerProxy(self.env.xmlrpc_uri, **kw) def destroy_connection(self): -- cgit