From 9b994205a896fe69c7e9a9bfe1c393f820ffa6ae Mon Sep 17 00:00:00 2001 From: TerryHowe Date: Tue, 18 Aug 2015 17:23:16 -0600 Subject: [PATCH] Do not log binary data during debug Do not log binary data during debug logging of a session. Replace the binary data with the string instead. Change-Id: I5184002f3a21c5e0ee510b21b9a7884c8dccd1e3 --- keystoneauth1/session.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/keystoneauth1/session.py b/keystoneauth1/session.py index 36a4f6b4..0f6d8671 100644 --- a/keystoneauth1/session.py +++ b/keystoneauth1/session.py @@ -202,6 +202,11 @@ class Session(object): if json: data = self._json.encode(json) if data: + if isinstance(data, six.binary_type): + try: + data = data.decode("ascii") + except UnicodeDecodeError: + data = "" string_parts.append("-d '%s'" % data) logger.debug(' '.join(string_parts))