diff --git a/lib/charms/tls_certificates_interface/v4/tls_certificates.py b/lib/charms/tls_certificates_interface/v4/tls_certificates.py index cb24d77..278207d 100644 --- a/lib/charms/tls_certificates_interface/v4/tls_certificates.py +++ b/lib/charms/tls_certificates_interface/v4/tls_certificates.py @@ -52,7 +52,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 4 +LIBPATCH = 5 PYDEPS = ["cryptography", "pydantic"] @@ -1030,7 +1030,14 @@ def _mode_is_valid(self, mode: Mode) -> bool: def _on_secret_remove(self, event: SecretRemoveEvent) -> None: """Handle Secret Removed Event.""" - event.secret.remove_revision(event.revision) + try: + event.secret.remove_revision(event.revision) + except SecretNotFoundError: + logger.warning( + "No such secret %s, nothing to remove", + event.secret.label or event.secret.id, + ) + return def _on_secret_expired(self, event: SecretExpiredEvent) -> None: """Handle Secret Expired Event.