From 9f5b88eb9ffcfd2de2501ce0576244de8fb0ae7c Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 4 Jan 2018 13:39:51 -0500 Subject: [PATCH] Fix nodemedia upload Implement the tracking properly --- confluent_client/bin/nodemedia | 15 ++++++++++++++- confluent_server/confluent/firmwaremanager.py | 6 +++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/confluent_client/bin/nodemedia b/confluent_client/bin/nodemedia index 9f3e98b7..6c2e76c9 100644 --- a/confluent_client/bin/nodemedia +++ b/confluent_client/bin/nodemedia @@ -35,6 +35,19 @@ import confluent.screensqueeze as sq exitcode = 0 + +def get_update_progress(session, url): + for res in session.read(url): + status = res['phase'] + percent = res['progress'] + detail = res['detail'] + if status == 'error': + text = 'error!' + else: + text = '{0}: {1:3.0f}%'.format(status, percent) + return text, status, detail + + def printerror(res, node=None): global exitcode if 'errorcode' in res: @@ -133,7 +146,7 @@ def main(): try: noderange = args[0] operation = args[1] - if operation == 'attach': + if operation in ('attach', 'upload'): media = args[2] except IndexError: argparser.print_help() diff --git a/confluent_server/confluent/firmwaremanager.py b/confluent_server/confluent/firmwaremanager.py index 0a7c8438..1cfd2583 100644 --- a/confluent_server/confluent/firmwaremanager.py +++ b/confluent_server/confluent/firmwaremanager.py @@ -111,7 +111,11 @@ def list_updates(nodes, tenant, element, type='firmware'): else: myparty = updatesbytarget verb = 'update' - if len(element) > 4: + if type == 'firmware': + specificlen = 4 + else: + specificlen = 2 + if len(element) > specificlen: showmode = True upid = element[-1] for node in nodes: