Skip to content

Commit

Permalink
Fix suggestions from hook25
Browse files Browse the repository at this point in the history
  • Loading branch information
LiaoU3 committed Jun 7, 2024
1 parent c775945 commit f6bf97e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions providers/base/bin/watchdog_config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def detect() -> None:
"Please define the WATCHDOG_TYPE and WATCHDOG_IDENTITY "
"in advance!"
)
input_identities = os.environ["WATCHDOG_IDENTITY"].split(",")

# Iterate over watchdog devices
watchdogs = os.listdir("/sys/class/watchdog")
Expand All @@ -214,9 +215,12 @@ def detect() -> None:
with open(path, "r") as f:
identity = f.readline().strip()
print("Identity of {}: {}".format(path, identity))

try:
# check that the identity was expected
input_identities.remove(identity)
print("Identity of {}: {}".format(path, identity))
# Check if the identity matches the expected identity
if identity != os.environ["WATCHDOG_IDENTITY"]:
except KeyError:
raise SystemExit(
"Found an unmatched watchdog!\n"
"Expected: {}\n"
Expand Down

0 comments on commit f6bf97e

Please sign in to comment.