From 36e68ca852013c5de2451ffcf58e8891675789b9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 29 Jan 2018 14:19:25 -0500 Subject: [PATCH] Fix nodemedia list when errors are present It would assume that databynode is always good news, but error data can come as well. --- confluent_client/bin/nodemedia | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodemedia b/confluent_client/bin/nodemedia index 6b09cc8c..a55cb106 100644 --- a/confluent_client/bin/nodemedia +++ b/confluent_client/bin/nodemedia @@ -81,10 +81,12 @@ def list_media(noderange, media): for res in session.read(resource): printerror(res) for node in res.get('databynode', []): - url = res['databynode'][node]['url'] - name = res['databynode'][node]['name'] + url = res['databynode'][node].get('url', None) + name = res['databynode'][node].get('name', None) if url and not res['databynode'][node].get('secure', False): name += ' (insecure)' + if not name: + continue print('{0}: {1}'.format(node, url + '/' + name if url else name))