canonical / sysbench-operator

Charm to manage sysbench and connect with Data Platform databases
Apache License 2.0
1 stars 0 forks source link

_use_external_connection must raise an exception if no units are present #20

Closed phvalguima closed 5 months ago

phvalguima commented 6 months ago

The method _use_external_connection should only resolve to False if: (1) the config option is set to False; or (2) the relation is not done via CMR. In any other case, it must raise an exception to be caught by RelationManager and abandon that event.

The main reason is because database_requested event happens once on the Provider side, and this event reports if the requirer needs to be exposed (i.e. external-node-connectivity=True) or not.

Therefore, we should only publish the database name on the relation databag once the sysbench spotted the first unit in the remote end and can correctly decide if we are dealing with a CMR or not.

github-actions[bot] commented 6 months ago

https://warthogs.atlassian.net/browse/DPE-3897

phvalguima commented 6 months ago

I believe we need to relax this section of data_interfaces: https://github.com/canonical/data-platform-libs/blob/306fa90aa77f31c9c5259b5dcb6e53844a355abf/lib/charms/data_platform_libs/v0/data_interfaces.py#L2377

To truly resolve this issue.