From 236d889d5df197add0370e43b8673f2a6ef00168 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sun, 5 Mar 2017 09:20:50 -0500 Subject: [PATCH] Fix error on 'isset' data isset data is to be redacted. This handles that situation, and also provides a repr if all else fails. --- confluent_client/confluent/client.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/confluent_client/confluent/client.py b/confluent_client/confluent/client.py index b83050e1..5d213003 100644 --- a/confluent_client/confluent/client.py +++ b/confluent_client/confluent/client.py @@ -97,12 +97,17 @@ class Command(object): else: rc |= 1 elif ikey in res[node]: + if 'value' in res[node][ikey]: + val = res[node][ikey]['value'] + elif 'isset' in res[node][ikey]: + val = '********' if res[node][ikey] else '' + else: + val = repr(res[node][ikey]) if self._prevkeyname and self._prevkeyname in res[node]: print('{0}: {2}->{1}'.format( - node, res[node][ikey]['value'], - res[node][self._prevkeyname]['value'])) + node, val, res[node][self._prevkeyname]['value'])) else: - print('{0}: {1}'.format(node, res[node][ikey]['value'])) + print('{0}: {1}'.format(node, val)) return rc def simple_noderange_command(self, noderange, resource, input=None,