From 6ee2ad35e1a5285fb1df6dbd3ecbd9338a7f2238 Mon Sep 17 00:00:00 2001 From: Neha Oudin <17551419+Gu1nness@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:30:28 +0200 Subject: [PATCH] fix: export fallback out of get (#510) --- lib/charms/mongodb/v1/mongodb_backups.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/charms/mongodb/v1/mongodb_backups.py b/lib/charms/mongodb/v1/mongodb_backups.py index c15e5bafe..559242f67 100644 --- a/lib/charms/mongodb/v1/mongodb_backups.py +++ b/lib/charms/mongodb/v1/mongodb_backups.py @@ -41,7 +41,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 5 +LIBPATCH = 6 logger = logging.getLogger(__name__) @@ -800,7 +800,7 @@ def get_backup_error_status(self, backup_id: str) -> str: """Get the error status for a provided backup.""" pbm_status = self.charm.run_pbm_command(["status", "--out=json"]) pbm_status = json.loads(pbm_status) - backups = pbm_status["backups"].get("snapshot", []) + backups = pbm_status["backups"].get("snapshot") or [] for backup in backups: if backup_id == backup["name"]: return backup.get("error", "")