From 1e78f11c2b543a90570f1c90fe453be35f0ac974 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 3 Nov 2022 09:38:39 -0400 Subject: [PATCH] Fix nodediscover CLI for subscribe/unsubscribe --- confluent_client/bin/nodediscover | 11 ++++++++--- confluent_server/confluent/discovery/core.py | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/confluent_client/bin/nodediscover b/confluent_client/bin/nodediscover index 83eadd9d..1b0f6fe9 100755 --- a/confluent_client/bin/nodediscover +++ b/confluent_client/bin/nodediscover @@ -53,9 +53,14 @@ columnmapping = { def subscribe_discovery(options, session, subscribe): keyn = 'subscribe' if subscribe else 'unsubscribe' payload = {keyn: options.node} - for rsp in session.update('/discovery/subscription', payload): - if 'status' in rsp: - print(rsp['status']) + if subscribe: + for rsp in session.update('/discovery/subscriptions/{0}'.format(options.node), payload): + if 'status' in rsp: + print(rsp['status']) + else: + for rsp in session.delete('/discovery/subscriptions/{0}'.format(options.node)): + if 'status' in rsp: + print(rsp['status']) def print_disco(options, session, currmac, outhandler, columns): procinfo = {} diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 89db2ac5..db4f66a0 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -518,7 +518,7 @@ def handle_read_api_request(pathcomponents): dirlist = [msg.ChildCollection(x + '/') for x in sorted(list(subcats))] dirlist.append(msg.ChildCollection('rescan')) dirlist.append(msg.ChildCollection('autosense')) - dirlist.append(msg.ChildCollection('subscription')) + dirlist.append(msg.ChildCollection('subscriptions/')) return dirlist if not coll: return show_info(queryparms['by-mac'])