From ed4ed48375db3afd70d481500633dd092c730a11 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 24 Oct 2024 15:43:32 +0530 Subject: [PATCH] Add mutex lock file to registry CLI wrapper class --- stack_orchestrator/deploy/webapp/registry_mutex.py | 2 +- stack_orchestrator/deploy/webapp/util.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/registry_mutex.py b/stack_orchestrator/deploy/webapp/registry_mutex.py index 392b74d9..7c835f19 100644 --- a/stack_orchestrator/deploy/webapp/registry_mutex.py +++ b/stack_orchestrator/deploy/webapp/registry_mutex.py @@ -10,7 +10,7 @@ def registry_mutex(): @wraps(func) def wrapper(self, *args, **kwargs): lock_file_path = DEFAULT_LOCK_FILE_PATH - if self.mutex_lock_file is not None: + if self.mutex_lock_file: lock_file_path = self.mutex_lock_file with open(lock_file_path, 'w') as lock_file: diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index 5f63687c..e587787e 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -114,9 +114,10 @@ def is_id(name_or_id: str): class LaconicRegistryClient: - def __init__(self, config_file, log_file=None): + def __init__(self, config_file, log_file=None, mutex_lock_file=None): self.config_file = config_file self.log_file = log_file + self.mutex_lock_file = mutex_lock_file self.cache = AttrDict( { "name_or_id": {},