Skip to content

Commit

Permalink
Make sure the override params yaml was parsed into a dicttionary
Browse files Browse the repository at this point in the history
  • Loading branch information
bjsowa committed Nov 14, 2023
1 parent 5981eb4 commit 49df369
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions leo_fw/leo_fw/nodes/parameter_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,18 @@ def load_override_params(self) -> None:
.string_value
)

self.override_params = {}

if override_params_file != "":
try:
with open(override_params_file, "r", encoding="utf-8") as file:
self.override_params: dict = yaml.safe_load(file)
override_yaml = yaml.safe_load(file)
if isinstance(override_yaml, dict):
self.override_params = override_yaml
except (FileNotFoundError, PermissionError, yaml.YAMLError) as exc:
self.get_logger().error("Failed to load parameter overrides!")
self.get_logger().error(str(exc))
else:
self.override_params = {}
self.get_logger().warning("Path to file with override parameters is empty.")

def parse_firmware_parameters(self) -> list[ParameterMsg]:
Expand Down

0 comments on commit 49df369

Please sign in to comment.