summaryrefslogtreecommitdiffstats
path: root/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
diff options
context:
space:
mode:
authorJoseph O'Leary <joseph.o.leary@est.tech>2020-08-18 08:15:56 +0000
committerGerrit Code Review <gerrit@onap.org>2020-08-18 08:15:56 +0000
commitd7f2b9e96e3c423a871fab757f3ae11372134125 (patch)
tree8bffddc6ff2e75161504a3302f37a856b2099030 /components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
parent4feffc20485b5bd304d0dc1edb9255c2cc55ed20 (diff)
parent38ccb471732faaad6a25defee0753c1c5ac60cf0 (diff)
Merge "Refactor and bug fixes"
Diffstat (limited to 'components/pm-subscription-handler/pmsh_service/mod/exit_handler.py')
-rwxr-xr-xcomponents/pm-subscription-handler/pmsh_service/mod/exit_handler.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
index 3d02375d..12932966 100755
--- a/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
+++ b/components/pm-subscription-handler/pmsh_service/mod/exit_handler.py
@@ -25,28 +25,28 @@ class ExitHandler:
Args:
periodic_tasks (List[PeriodicTask]): PeriodicTasks that needs to be cancelled.
+ app_conf (AppConfig): The PMSH Application Configuration.
subscription_handler (SubscriptionHandler): The subscription handler instance.
"""
shutdown_signal_received = False
- def __init__(self, *, periodic_tasks, subscription_handler):
+ def __init__(self, *, periodic_tasks, app_conf, subscription_handler):
self.periodic_tasks = periodic_tasks
+ self.app_conf = app_conf
self.subscription_handler = subscription_handler
def __call__(self, sig_num, frame):
logger.info('Graceful shutdown of PMSH initiated.')
logger.debug(f'ExitHandler was called with signal number: {sig_num}.')
- current_sub = self.subscription_handler.current_sub
- if current_sub and current_sub.administrativeState == AdministrativeState.UNLOCKED.value:
+ current_sub = self.app_conf.subscription
+ if current_sub.administrativeState == AdministrativeState.UNLOCKED.value:
try:
+ current_sub.deactivate_subscription(self.subscription_handler.mr_pub, self.app_conf)
+ current_sub.update_subscription_status()
for thread in self.periodic_tasks:
logger.debug(f'Cancelling periodic task with thread name: {thread.name}.')
thread.cancel()
- current_sub.administrativeState = AdministrativeState.LOCKED.value
- current_sub.process_subscription(current_sub.get_network_functions(),
- self.subscription_handler.mr_pub,
- self.subscription_handler.app_conf)
except Exception as e:
logger.error(f'Failed to shut down PMSH application: {e}', exc_info=True)
ExitHandler.shutdown_signal_received = True