diff options
-rw-r--r-- | ipa.1 | 3 | ||||
-rw-r--r-- | ipalib/backend.py | 2 | ||||
-rw-r--r-- | ipalib/rpc.py | 11 |
3 files changed, 12 insertions, 4 deletions
@@ -56,7 +56,8 @@ Prompt for all parameters of \fICOMMAND\fR, even if they are optional. Don't fall back to other IPA servers if the default doesn't work. .TP \fB\-v\fR, \fB\-\-verbose\fR -Produce verbose output. A second \-v displays the XML\-RPC request. +Produce verbose output. A second -v pretty-prints the JSON request and response. A third \-v displays the HTTP request and response. +.TP \fB\-\-version\fR Display the IPA version and API version. .SH "COMMANDS" diff --git a/ipalib/backend.py b/ipalib/backend.py index b94264236..210058981 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -113,7 +113,7 @@ class Executioner(Backend): if self.env.in_server: self.Backend.ldap2.connect(ccache=ccache) else: - self.Backend.rpcclient.connect(verbose=(self.env.verbose >= 2), + self.Backend.rpcclient.connect(verbose=self.env.verbose, fallback=self.env.fallback, delegate=self.env.delegate) if client_ip is not None: setattr(context, "client_ip", client_ip) diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 1bfc4c3d3..e7e60f414 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -761,7 +761,7 @@ class RPCClient(Connectible): return session_url - def create_connection(self, ccache=None, verbose=False, fallback=True, + def create_connection(self, ccache=None, verbose=0, fallback=True, delegate=False, nss_dir=None): try: rpc_uri = self.env[self.env_rpc_uri_key] @@ -965,11 +965,15 @@ class JSONServerProxy(object): payload = {'method': unicode(name), 'params': args, 'id': 0} version = args[1].get('version', VERSION_WITHOUT_CAPABILITIES) + if self.__verbose >= 2: + root_logger.info('Request: %s', + json.dumps(payload, sort_keys=True, indent=4)) + response = self.__transport.request( self.__host, self.__handler, json.dumps(json_encode_binary(payload, version)), - verbose=self.__verbose, + verbose=self.__verbose >= 3, ) try: @@ -977,6 +981,9 @@ class JSONServerProxy(object): except ValueError, e: raise JSONError(str(e)) + if self.__verbose >= 2: + root_logger.info('Response: %s', + json.dumps(response, sort_keys=True, indent=4)) error = response.get('error') if error: try: |