From 0431e424528ab56e0842e464bba2259152f599e2 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 29 Jan 2018 14:21:38 -0500 Subject: [PATCH] Do not attempt to list after error On upload/attach errors, do not bother to try to follow up with list media, as the previous failure is more useful. --- 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 a55cb106..a9fbc999 100644 --- a/confluent_client/bin/nodemedia +++ b/confluent_client/bin/nodemedia @@ -72,7 +72,8 @@ def attach_media(noderange, media): resource = '/noderange/{0}/media/attach'.format(noderange) for res in session.update(resource, {'url': media}): printerror(res) - list_media(noderange, media) + if not exitcode: + list_media(noderange, media) def list_media(noderange, media): @@ -135,7 +136,8 @@ def upload_media(noderange, media): 'Nodes had errors receiving media ({0})!\n'.format(allerrnodes)) for node in noderrs: sys.stderr.write('{0}: {1}\n'.format(node, noderrs[node])) - list_media(noderange, media) + if not exitcode: + list_media(noderange, media) funmap = { 'upload': upload_media,