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 5f8eab8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nebula/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import nebula

logging.getLogger().setLevel(logging.WARNING)
log = logging.getLogger(__name__)


class MyFilter(logging.Filter):
Expand Down Expand Up @@ -1529,6 +1530,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 +1542,9 @@ def board_status(
yamlfilename="/etc/default/nebula",
board_name=None,
load_config=True,
fail_if_inactive=False,
):
"""Get device status"""
"""Get device status."""
nb = nebula.netbox(
ip=netbox_ip,
port=netbox_port,
Expand All @@ -1552,7 +1555,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 fail_if_inactive:
if not str(device.status()) == "Active":
raise Exception(f"{board_name} not Active")
return


netbox = Collection("netbox")
Expand Down

0 comments on commit 5f8eab8

Please sign in to comment.