From 66d0fd5c2ef6804b1073cdec9281fde2aee66e43 Mon Sep 17 00:00:00 2001 From: Guillaume Boutry Date: Wed, 12 Mar 2025 11:57:02 +0100 Subject: [PATCH] Ensure identity credentials are requested Change-Id: Ib7c541865303204a52d352ef7a180d07db5b145b Signed-off-by: Guillaume Boutry --- ops-sunbeam/ops_sunbeam/relation_handlers.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ops-sunbeam/ops_sunbeam/relation_handlers.py b/ops-sunbeam/ops_sunbeam/relation_handlers.py index 0df02498..83375872 100644 --- a/ops-sunbeam/ops_sunbeam/relation_handlers.py +++ b/ops-sunbeam/ops_sunbeam/relation_handlers.py @@ -628,6 +628,13 @@ class IdentityServiceRequiresHandler(RelationHandler): if self.mandatory: self.status.set(BlockedStatus("integration missing")) + def update_relation_data(self): + """Update relation outside of relation context.""" + if self.model.get_relation(self.relation_name): + self.interface.register_services( + self.service_endpoints, self.region + ) + def update_service_endpoints(self, service_endpoints: list[dict]) -> None: """Update service endpoints on the relation.""" self.service_endpoints = service_endpoints @@ -1397,6 +1404,11 @@ class IdentityCredentialsRequiresHandler(RelationHandler): if self.mandatory: self.status.set(BlockedStatus("integration missing")) + def update_relation_data(self): + """Update relation outside of relation context.""" + if self.model.get_relation(self.relation_name): + self.interface.request_credentials() + @property def ready(self) -> bool: """Whether handler is ready for use."""