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 16c38cd commit 4b07775
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions nebula/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ def enable_board(
"yamlfilename": "Path to yaml config file. Default: /etc/default/nebula",
"board_name": "Name of DUT design (Ex: zynq-zc706-adv7511-fmcdaq2). Require for multi-device config files",
"load_config": "Load configuration parameters from yamlfilename. Default: true",
"fail_if_inactive": "Raise exception if board is not active",
}
)
def board_status(
Expand All @@ -1540,8 +1541,9 @@ def board_status(
yamlfilename="/etc/default/nebula",
board_name=None,
load_config=True,
fail_if_inactive=False,
):
"""Get device status. Returns -1 if not active"""
"""Get device status."""
nb = nebula.netbox(
ip=netbox_ip,
port=netbox_port,
Expand All @@ -1553,10 +1555,10 @@ def board_status(
)
device = nebula.NetboxDevice(nb)
log.info(f"{board_name} status is {device.status()}")
if device.status() != "active":
return -1
else:
return 0
if fail_if_inactive:
if device.status != "Active":
raise Exception(f"{board_name} not Active")
return


netbox = Collection("netbox")
Expand Down

0 comments on commit 4b07775

Please sign in to comment.