From 1392bd76d6b217bc403d58dec5149e10ef8fe1df Mon Sep 17 00:00:00 2001 From: Vishal Dalwadi Date: Thu, 3 Sep 2026 11:26:50 +0530 Subject: [PATCH] feat(sh): delete host instead of delete node; --- scripts/nm-quick.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/nm-quick.sh b/scripts/nm-quick.sh index e943c82ba..ed772572a 100755 --- a/scripts/nm-quick.sh +++ b/scripts/nm-quick.sh @@ -896,13 +896,13 @@ cleanup() { if ! command -v netclient >/dev/null 2>&1; then return fi - if command -v nmctl >/dev/null 2>&1; then - local node_id=$(netclient list | jq '.[0].node_id' 2>/dev/null) - node_id="${node_id//\"/}" - if test -n "$node_id"; then - echo "De-registering the existing netclient..." - nmctl node delete netmaker $node_id >/dev/null 2>&1 - fi + local host_id + host_id=$(sudo cat /etc/netclient/netclient.json 2>/dev/null | jq -r '.id' 2>/dev/null) + if [ -n "$host_id" ] && [ "$host_id" != "null" ]; then + echo "De-registering the existing netclient host..." + curl -s -o /dev/null -X DELETE "https://api.${NETMAKER_BASE_DOMAIN}/api/hosts/${host_id}?force=true" \ + -H "Authorization: Bearer ${MASTER_KEY}" \ + -H "Content-Type: application/json" fi fi