From eec248e0ba3ac8ef4e16548ff479127cea05da76 Mon Sep 17 00:00:00 2001 From: Iakov Gan Date: Wed, 13 Nov 2024 19:32:50 +0100 Subject: [PATCH] make safer update --- cid/helpers/quicksight/dashboard.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cid/helpers/quicksight/dashboard.py b/cid/helpers/quicksight/dashboard.py index 5476fd37..27c7636f 100644 --- a/cid/helpers/quicksight/dashboard.py +++ b/cid/helpers/quicksight/dashboard.py @@ -74,7 +74,11 @@ def deployed_cid_version(self) -> int: @property def latest(self) -> bool: - return self.latest_available_cid_version == self.deployed_cid_version + try: + return self.latest_available_cid_version == self.deployed_cid_version + except Exception as exc: + logger.debug(f'Failed to determine if latest for dashboards: {self.id}. {exc}') + return None @property def health(self) -> bool: @@ -82,9 +86,9 @@ def health(self) -> bool: @property def origin_type(self) -> str: - if self.deployedTemplate is not None: + if self.deployedTemplate: return "TEMPLATE" - elif self.deployedDefinition is not None: + elif self.deployedDefinition: return "DEFINITION" else: return "UNKNOWN" @@ -101,9 +105,9 @@ def cid_version(self) -> int: @property def latest_available_cid_version(self) -> int: - if self.origin_type == "TEMPLATE": + if self.sourceTemplate: return self.sourceTemplate.cid_version - elif self.origin_type == "DEFINITION": + elif self.sourceDefinition: return self.sourceDefinition.cid_version else: return None