From 9b542987f0ac56f304db6711f76f0fd9b0060ec8 Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Wed, 19 Jun 2024 08:47:28 +0200 Subject: [PATCH 1/2] guard on clear --- lib/charms/observability_libs/v1/cert_handler.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/charms/observability_libs/v1/cert_handler.py b/lib/charms/observability_libs/v1/cert_handler.py index 362240a..23097b1 100644 --- a/lib/charms/observability_libs/v1/cert_handler.py +++ b/lib/charms/observability_libs/v1/cert_handler.py @@ -260,7 +260,13 @@ def retrieve(self) -> Dict[str, str]: def clear(self): """Clear the vault.""" - self._backend.clear() + try: + self._backend.clear() + except SecretNotFoundError: + # guard against: https://github.com/canonical/observability-libs/issues/95 + # this is fine, it might mean an earlier hook had already called .clear() + # not sure what exactly the root cause is, might be a juju bug + logger.debug("Could not clear vault: secret is gone already.") class CertHandler(Object): From fb9ff61b1b7cec80cf587ed029801e978f1abffa Mon Sep 17 00:00:00 2001 From: Pietro Pasotti Date: Wed, 19 Jun 2024 08:51:30 +0200 Subject: [PATCH 2/2] vbump --- lib/charms/observability_libs/v1/cert_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/charms/observability_libs/v1/cert_handler.py b/lib/charms/observability_libs/v1/cert_handler.py index 23097b1..3eca976 100644 --- a/lib/charms/observability_libs/v1/cert_handler.py +++ b/lib/charms/observability_libs/v1/cert_handler.py @@ -67,7 +67,7 @@ LIBID = "b5cd5cd580f3428fa5f59a8876dcbe6a" LIBAPI = 1 -LIBPATCH = 10 +LIBPATCH = 11 VAULT_SECRET_LABEL = "cert-handler-private-vault"