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.
This commit is contained in:
Rob Crittenden 2010-06-03 17:07:24 -04:00
parent 4924270b45
commit 1dd7b11b0b
5 changed files with 12 additions and 9 deletions

7
ipa.1
View File

@ -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).

View File

@ -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)

View File

@ -118,7 +118,7 @@ DEFAULT_CONFIG = (
('webui_assets_dir', None),
# Debugging:
('verbose', False),
('verbose', 0),
('debug', False),
('mode', 'production'),

View File

@ -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',

View File

@ -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):