Skip to content

Commit

Permalink
tasks: set device status to verbose and fix return
Browse files Browse the repository at this point in the history
Signed-off-by: kimpaller <[email protected]>
  • Loading branch information
kimpaller committed Oct 29, 2024
1 parent 646f4b2 commit 16c38cd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nebula/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import nebula

logging.getLogger().setLevel(logging.WARNING)

log = logging.getLogger(__name__)

class MyFilter(logging.Filter):
def filter(self, record):
Expand Down Expand Up @@ -1541,7 +1541,7 @@ def board_status(
board_name=None,
load_config=True,
):
"""Get device status"""
"""Get device status. Returns -1 if not active"""
nb = nebula.netbox(
ip=netbox_ip,
port=netbox_port,
Expand All @@ -1552,7 +1552,11 @@ def board_status(
load_config=load_config,
)
device = nebula.NetboxDevice(nb)
return device.status()
log.info(f"{board_name} status is {device.status()}")
if device.status() != "active":
return -1
else:
return 0


netbox = Collection("netbox")
Expand Down

0 comments on commit 16c38cd

Please sign in to comment.