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

[Missing] data interfaces should provide a property to ensure `database_requested` has run #193

Closed Gu1nness closed 1 month ago

Gu1nness commented 2 months ago

If a charm needs to do some updates of the stored data/secrets in a relation_changed event for example, it has to check that the database_requested event has run. Currently, there is no documentation on how to do that, nor a property or a check function to do that.

Adding a is_relation_setup or equivalent + the according documentation and a small example should do the thing.

syncronize-issues-to-jira[bot] commented 2 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-5306.

This message was autogenerated

juditnovak commented 2 months ago

Thank you very much for reporting. Indeed it's a serious concern.

Instead of property + docs what we provide is the following: as long as the database field is not set on the relation, the Provicer (the side creating secrets) will not be allowed to apply write operation.

If the Provider would make an attempt to executeupdate_relation_data() it would throw an exception indicating that the opration is premature.