This PR addresses a bug where if a requirer charm that is related to the OpenFGA charm is scaled to more than 1 unit, the following error shows in the logs:
unit-temporal-k8s-1: 14:29:17 ERROR unit.temporal-k8s/1.juju-log openfga:18: Uncaught exception while in charm code:
...
File "/var/lib/juju/agents/unit-temporal-k8s-1/charm/lib/charms/openfga_k8s/v1/openfga.py", line 240, in _on_relation_created
OpenfgaRequirerAppData(store_name=self.store_name).dump(databag)
File "/var/lib/juju/agents/unit-temporal-k8s-1/charm/lib/charms/openfga_k8s/v1/openfga.py", line 146, in dump
databag[field.alias or key] = (
File "/var/lib/juju/agents/unit-temporal-k8s-1/charm/venv/ops/model.py", line 1474, in __setitem__
self._validate_write(key, value)
File "/var/lib/juju/agents/unit-temporal-k8s-1/charm/venv/ops/model.py", line 1460, in _validate_write
raise RelationDataAccessError(
ops.model.RelationDataAccessError: temporal-k8s/1 is not leader and cannot write application data.
Therefore, it checks for unit leadership before dumping data in the relation databag.
It also updates the README to reflect the new library version and instructions, as running a schema upgrade action is no longer required when the charm is initially deployed.
This PR addresses a bug where if a requirer charm that is related to the OpenFGA charm is scaled to more than 1 unit, the following error shows in the logs:
Therefore, it checks for unit leadership before dumping data in the relation databag.
It also updates the README to reflect the new library version and instructions, as running a schema upgrade action is no longer required when the charm is initially deployed.