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 5f5d285
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 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 @@ -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"""
"""Get device status."""
nb = nebula.netbox(
ip=netbox_ip,
port=netbox_port,
Expand All @@ -1552,7 +1554,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 5f5d285

Please sign in to comment.