canonical / data-platform-libs

A collection of charm libraries curated by the Data Platform Team
https://charmhub.io/data-platform-libs
Apache License 2.0
10 stars 9 forks source link

fix ModelError exception #63

Closed delgod closed 1 year ago

delgod commented 1 year ago

Using Juju 3.2.0 and data_interfaces 0.15, if the developer tries to access the relation data early in the charm's life (i.e. in the constructor), then in some cases, a ModelError is thrown and not yet caught.

This occurs most obviously when scaling an application - the peer relation joined hook fires very early in the new unit's life, and if _is_relation_active is called at this point, a ModelError can be thrown.

fixes https://pastebin.canonical.com/p/zKJPQ8B3gy/