summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2015-01-12 14:18:49 +0100
committerPetr Vobornik <pvoborni@redhat.com>2015-01-13 10:18:33 +0100
commita18ef90284f627bdde1e264e5e3db3a52031feec (patch)
treed0c9e702ef13add6ee7b9695e84e7d3ddc7a8277
parente6beaaccceb01a3ce56cfa3edfc8ab0191d51bb1 (diff)
rpcclient: use json_encode_binary for verbose output
`json.dumps` is not able to process some IPA's object types and therefore requires to preprocess it with `json_encode_binary` call. This step was not used in rpcclient's verbose output. https://fedorahosted.org/freeipa/ticket/4773 Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r--ipalib/rpc.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index ab5b2f630..6a1c983c0 100644
--- a/ipalib/rpc.py
+++ b/ipalib/rpc.py
@@ -971,6 +971,7 @@ class JSONServerProxy(object):
def __request(self, name, args):
payload = {'method': unicode(name), 'params': args, 'id': 0}
version = args[1].get('version', VERSION_WITHOUT_CAPABILITIES)
+ payload = json_encode_binary(payload, version)
if self.__verbose >= 2:
root_logger.info('Request: %s',
@@ -979,7 +980,7 @@ class JSONServerProxy(object):
response = self.__transport.request(
self.__host,
self.__handler,
- json.dumps(json_encode_binary(payload, version)),
+ json.dumps(payload),
verbose=self.__verbose >= 3,
)
@@ -989,8 +990,11 @@ class JSONServerProxy(object):
raise JSONError(str(e))
if self.__verbose >= 2:
- root_logger.info('Response: %s',
- json.dumps(response, sort_keys=True, indent=4))
+ root_logger.info(
+ 'Response: %s',
+ json.dumps(json_encode_binary(response, version),
+ sort_keys=True, indent=4)
+ )
error = response.get('error')
if error:
try: