Skip to content

Commit

Permalink
src - Fix issue with bool values
Browse files Browse the repository at this point in the history
  • Loading branch information
phibos committed Jul 15, 2024
1 parent 0673063 commit 2250d70
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion routeros_check/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ def get_routeros_metric_item(
logger.warning(f"Error parsing value with name {metric_value_name}", exc_info=True)
raise e

value = value * metric_value.get("factor", 1)
value_factor = metric_value.get("factor")
if value_factor is not None:
if isinstance(value, bool):
logger.warning(f"Unable to use factor with bool metric {metric_value_name}", exc_info=True)
raise ValueError(f"Unable to use factor with bool metric {metric_value_name}")
value = value * value_factor

extra_kwargs = {}
for n in ("min", "max", "uom"):
Expand Down

0 comments on commit 2250d70

Please sign in to comment.