mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user