[ops-sunbeam] ingress_changed can fail when the relation is gone

Catch AttributeError/KeyError as a stop gap to prevent _ingress_changed
to fail on relation-broken.

Change-Id: Ib29af68bf498c6adb84064f871dc678b783213c3
Signed-off-by: Guillaume Boutry <guillaume.boutry@canonical.com>
This commit is contained in:
Guillaume Boutry 2024-08-21 09:10:48 +02:00
parent 8ca8d63e3a
commit 5210d9e230
No known key found for this signature in database
GPG Key ID: E95E3326872E55DE

View File

@ -851,9 +851,12 @@ class OSBaseOperatorAPICharm(OSBaseOperatorCharmK8S):
logger.debug("Received an ingress_changed event")
if hasattr(self, "id_svc"):
logger.debug(
"Updating service endpoints after ingress " "relation changed."
"Updating service endpoints after ingress relation changed."
)
self.id_svc.update_service_endpoints(self.service_endpoints)
try:
self.id_svc.update_service_endpoints(self.service_endpoints)
except (AttributeError, KeyError):
pass
self.configure_charm(event)