From c1162e966f1efc0d122d72be847bf1f3f2ff2cd1 Mon Sep 17 00:00:00 2001 From: kimpaller Date: Wed, 23 Oct 2024 13:41:26 +0800 Subject: [PATCH] do not include tags in enabling/disabling device Signed-off-by: kimpaller --- nebula/netbox.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nebula/netbox.py b/nebula/netbox.py index c2ace3e..567298b 100644 --- a/nebula/netbox.py +++ b/nebula/netbox.py @@ -562,15 +562,16 @@ def to_config(self, template): # noqa: C901 def enable(self, reason="nebula: Enable device"): device_id = self.data["devices"]["id"] author = self.nbi.get_user_from_token() - self.nbi.add_tag(device_id=device_id, tag="active") self.nbi.update_status(device_id=device_id, status="active") self.nbi.log_journal(device_id=device_id, author_id=author.id, comments=reason) - def disable(self, reason="nebula: Disable device"): + def disable(self, reason="nebula: Disable device", failed=False): device_id = self.data["devices"]["id"] author = self.nbi.get_user_from_token() - self.nbi.remove_tag(device_id=device_id, tag="active") - self.nbi.update_status(device_id=device_id, status="offline") + if failed: + self.nbi.update_status(device_id=device_id, status="failed") + else: + self.nbi.update_status(device_id=device_id, status="offline") self.nbi.log_journal(device_id=device_id, author_id=author.id, comments=reason)