diff --git a/confluent_client/bin/nodemedia b/confluent_client/bin/nodemedia index 78fa62e2..9f3e98b7 100644 --- a/confluent_client/bin/nodemedia +++ b/confluent_client/bin/nodemedia @@ -62,14 +62,14 @@ def list_media(noderange, media): for node in res.get('databynode', []): url = res['databynode'][node]['url'] name = res['databynode'][node]['name'] - print('{0}: {1}'.format(node, url if url else name)) + print('{0}: {1}'.format(node, url + '/' + name if url else name)) def detach_media(noderange, media): global exitcode session = client.Command() resource = '/noderange/{0}/media/detach'.format(noderange) - for res in session.update(resource, {'detach': media}): + for res in session.update(resource, {'detachall': 1}): printerror(res) @@ -125,7 +125,7 @@ def main(): "|all|", epilog='upload will take the specified file and upload it to the BMC, ' 'attach will instruct the BMC to connect a remote media to the ' - 'specified url, and detach all will remove all uploaded and' + 'specified url, and detach will remove all uploaded and' 'attached urls from the BMC, list shows currently mounted ' 'media.') (options, args) = argparser.parse_args() @@ -133,7 +133,7 @@ def main(): try: noderange = args[0] operation = args[1] - if operation != 'list': + if operation == 'attach': media = args[2] except IndexError: argparser.print_help() diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index ebec4876..81b3de9a 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -431,11 +431,14 @@ class InputMedia(InputFirmwareUpdate): # Use InputFirmwareUpdate pass + class DetachMedia(ConfluentMessage): def __init__(self, path, nodes, inputdata): - if inputdata['detach'] != 'all': + if 'detachall' not in inputdata: raise exc.InvalidArgumentException('Currently only supporting' - '{"detach": "all"}') + '{"detachall": 1}') + + class Media(ConfluentMessage): def __init__(self, node, media): self.kvpairs = {node: {'name': media.name, 'url': media.url}}