Skip to content

Commit

Permalink
add try
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed May 11, 2023
1 parent 1d248dd commit 94805f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/relations/mysql_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
MySQLGetClusterEndpointsError,
MySQLGetMySQLVersionError,
MySQLGrantPrivilegesToUserError,
MySQLRemoveRouterFromMetadataError,
)
from ops.charm import (
PebbleReadyEvent,
Expand Down Expand Up @@ -327,5 +328,8 @@ def _on_database_provides_relation_departed(self, event: RelationDepartedEvent)
return

if router_id := event.relation.data[event.departing_unit].get("router_id"):
self.charm._mysql.remove_router_from_cluster_metadata(router_id)
logger.info(f"Removed router from metadata {router_id}")
try:
self.charm._mysql.remove_router_from_cluster_metadata(router_id)
logger.info(f"Removed router from metadata {router_id}")
except MySQLRemoveRouterFromMetadataError:
logger.error(f"Failed to remove router from metadata with ID {router_id}")

0 comments on commit 94805f0

Please sign in to comment.