2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 19:10:10 +00:00

Fix nodemedia list when errors are present

It would assume that databynode is always good news, but error data
can come as well.
This commit is contained in:
Jarrod Johnson 2018-01-29 14:19:25 -05:00
parent ba0e03d454
commit 36e68ca852

View File

@ -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))