From b503d9ca11d6f4a3e3f8dd20f3f6b696bf366aa8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 9 Sep 2016 09:14:25 -0400 Subject: [PATCH] Fix nodeeventlog with 'None' entries Some entries have 'None' fields. Gracefully tolerate this scenario. --- confluent_client/bin/nodeeventlog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/nodeeventlog b/confluent_client/bin/nodeeventlog index 13997ae9..b8fc22ad 100644 --- a/confluent_client/bin/nodeeventlog +++ b/confluent_client/bin/nodeeventlog @@ -49,11 +49,11 @@ def format_event(evt): display = dt.strptime(evt['timestamp'], '%Y-%m-%dT%H:%M:%S') retparts.append(display.strftime('%m/%d/%Y %H:%M:%S')) dscparts = [] - if 'component_type' in evt: + if 'component_type' in evt and evt['component_type'] is not None: dscparts.append(evt['component_type']) if 'component' in evt and evt['component'] is not None: dscparts.append(evt['component']) - if 'event' in evt and evt['event']: + if 'event' in evt and evt['event'] and evt['event'] is not None: evttext = evt['event'] try: if evttext.startswith(evt['component'] + ' - '): @@ -83,4 +83,4 @@ for rsp in func('/noderange/{0}/events/hardware/log'.format(noderange)): if 'events' in thisdata: evtdata = thisdata['events'] for evt in evtdata: - print '{0}: {1}'.format(node, format_event(evt)) \ No newline at end of file + print '{0}: {1}'.format(node, format_event(evt))