From b61712803ce5c8110b7c62051ddc75aa4cf1210d Mon Sep 17 00:00:00 2001 From: Dmitry Ratushnyy Date: Thu, 12 Oct 2023 13:57:29 +0000 Subject: [PATCH] Rerert changes --- lib/charms/data_platform_libs/v0/data_interfaces.py | 6 +++++- .../lib/charms/data_platform_libs/v0/data_interfaces.py | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/charms/data_platform_libs/v0/data_interfaces.py b/lib/charms/data_platform_libs/v0/data_interfaces.py index 04a9c327d..818de7b0c 100644 --- a/lib/charms/data_platform_libs/v0/data_interfaces.py +++ b/lib/charms/data_platform_libs/v0/data_interfaces.py @@ -1643,7 +1643,11 @@ def _assign_relation_alias(self, relation_id: int) -> None: logger.debug("Alias %s was already assigned to relation %d", alias, relation.id) available_aliases.remove(alias) - # Set the alias in app relation databag of the specific relation. + # Set the alias in the unit relation databag of the specific relation. + relation = self.charm.model.get_relation(self.relation_name, relation_id) + relation.data[self.local_unit].update({"alias": available_aliases[0]}) + + # Set the alias in the app relation databag of the specific relation. self.update_relation_data(relation_id, {"alias": available_aliases[0]}) def _emit_aliased_event(self, event: RelationChangedEvent, event_name: str) -> None: diff --git a/tests/integration/relation_tests/new_relations/application-charm/lib/charms/data_platform_libs/v0/data_interfaces.py b/tests/integration/relation_tests/new_relations/application-charm/lib/charms/data_platform_libs/v0/data_interfaces.py index 1e640f785..818de7b0c 100644 --- a/tests/integration/relation_tests/new_relations/application-charm/lib/charms/data_platform_libs/v0/data_interfaces.py +++ b/tests/integration/relation_tests/new_relations/application-charm/lib/charms/data_platform_libs/v0/data_interfaces.py @@ -1643,6 +1643,10 @@ def _assign_relation_alias(self, relation_id: int) -> None: logger.debug("Alias %s was already assigned to relation %d", alias, relation.id) available_aliases.remove(alias) + # Set the alias in the unit relation databag of the specific relation. + relation = self.charm.model.get_relation(self.relation_name, relation_id) + relation.data[self.local_unit].update({"alias": available_aliases[0]}) + # Set the alias in the app relation databag of the specific relation. self.update_relation_data(relation_id, {"alias": available_aliases[0]})