Closed Pjack closed 2 months ago
As part of this PR to add smartctl exporter support for the charm, we are removing the usage of Stored State to check whether an exporter is installed.
In the same PR, we're also using separate variables (render_config_success
, render_service_success
) and so we won't face this issue in the exporter install function. Refer here.
In my understanding reading the code is:
/etc/systemd/system/hardware-exporter/.service
and/etc/hardware-exporter-config.yaml
This is very easy to check and not CPU intensive by using Path.exists and I don't see the need at all of using
self._stored
and by consequence those type ignore.The juju sdk documentation has an interesting section of uses and limitations with StoredState and the problematic solution looks like a lot with what I'm seeing in this project.
I've spotted another possible issue into the install function:
https://github.com/canonical/hardware-observer-operator/blob/86f0d7e0dd8b0339740518b27eb224fb1fcaf2b9/src/service.py#L132-L149
See that if line 137 fails, it will overwrite the result on line 143 meaning that if for some reason the redfish config file fails, but for the service doesn't, you won't notice.
To say the truth I' would refactor those functions of
install
anduninstall
to return nothing and let to bubble in the charm code here_Originally posted by @gabrielcocenza in https://github.com/canonical/hardware-observer-operator/pull/192#discussion_r1536122008_