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

[BUG] `DataPeerOtherUnit` is instantiating the wrong handler #149

Closed juditnovak closed 5 months ago

juditnovak commented 6 months ago

Steps to reproduce

  1. Instantiate more than one DataPeerOtherUnit instances

Expected behavior

woks

Actual behavior

RuntimeError: two objects claiming to be OpensearchDasboardsCharm/DataPeerOtherUnit[dashboard_peers] have been created

Additional context

diff --git a/lib/charms/data_platform_libs/v0/data_interfaces.py b/lib/charms/data_platform_libs/v0/data_interfaces.py
index d24aa6f..bf7dd40 100644
--- a/lib/charms/data_platform_libs/v0/data_interfaces.py
+++ b/lib/charms/data_platform_libs/v0/data_interfaces.py
@@ -1820,7 +1820,7 @@ class DataPeerOtherUnit(DataPeerOtherUnitData, DataPeerOtherUnitEventHandlers):
             secret_field_name,
             deleted_label,
         )
-        DataPeerEventHandlers.__init__(self, charm, self, unique_key)
+        DataPeerOtherUnitEventHandlers.__init__(self, charm, self, unique_key)

 # General events
github-actions[bot] commented 6 months ago

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