canonical / hardware-observer-operator

A charm to setup prometheus exporter for IPMI, RedFish and RAID devices from different vendors.
Apache License 2.0
7 stars 14 forks source link

Add redfish credential validation in `validate_exporter_configs`. #182

Closed chanchiwai-ray closed 4 months ago

chanchiwai-ray commented 4 months ago

This PR introduces the validation for the runtime config (i.e. redfish related config) in validate_exporter_configs function, and move the charm to blocked if the validation did not pass.

Affected event: [install_or_upgrade, update_status, config_changed].

  1. install_or_upgrade: if during the charm install or charm refresh event, Redfish is detected and the redfish credential is not correct, the charm will be blocked.
  2. update_status: on every update status, the redfish credential will be validated if Redfish is detected. If it's not valid the charm will be blocked. If the redfish credential is currently valid, but the operator changed the password on the server, the charm will be blocked on update status.
  3. config_changed: on config changed, the redfish credential will be validated if Redfish is detected. If it's not valid the charm will be blocked.

Maybe fix: #155 Related to: #136