summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
diff options
context:
space:
mode:
authorefiacor <fiachra.corcoran@est.tech>2020-10-28 14:56:46 +0000
committerefiacor <fiachra.corcoran@est.tech>2020-11-18 09:49:09 +0000
commit062c4a7c72a1b45bc2e37a04b469321c5abc9d97 (patch)
tree6444859a7e02c1cae68c308b03f523f85861187a /components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
parent006ab23bc2863627571ea7a065de7b05e78b21f6 (diff)
[PMSH] Fix thread crash edge case
Signed-off-by: efiacor <fiachra.corcoran@est.tech> Change-Id: Iebfa05ebc78531191159adf5229ab39082dd1d58 Issue-ID: DCAEGEN2-2501
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
index 24eade98..c6be38d0 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/pmsh_utils.py
@@ -114,13 +114,11 @@ class AppConfig:
"""
try:
app_conf = self._get_pmsh_config()
- if "INVALID JSON" in app_conf.values():
- raise ValueError('Failed to refresh AppConfig: INVALID JSON')
self.subscription.administrativeState = app_conf['policy']['subscription'][
'administrativeState']
logger.info("AppConfig data has been refreshed")
except ValueError or Exception as e:
- logger.error(e)
+ logger.error(f'Failed to refresh AppConfig: {e}', exc_info=True)
def get_mr_sub(self, sub_name):
"""
@@ -287,4 +285,7 @@ class PeriodicTask(Timer):
def run(self):
self.function(*self.args, **self.kwargs)
while not self.finished.wait(self.interval):
- self.function(*self.args, **self.kwargs)
+ try:
+ self.function(*self.args, **self.kwargs)
+ except Exception as e:
+ logger.error(f'Exception in thread: {self.name}: {e}', exc_info=True)