canonical / blackbox-exporter-k8s-operator

https://charmhub.io/blackbox-exporter-k8s
Apache License 2.0
0 stars 3 forks source link

fix: tell type checks that the config options are strings #23

Open tonyandrewmeyer opened 7 months ago

tonyandrewmeyer commented 7 months ago

ops<=2.12 wrongly has self.config[x] typed as str, when actually it could be an int, float, bool, or str, depending on the config type. We're fixing this in ops:#1183, but that will break static checking that currently assumes that the config is a str (because ops doesn't validate the schema, so all options will be bool|int|float|str).

This PR adds a typing.cast call where the config values are loaded and used where the type should be str.