def _release_lock(lock_manager: ConsulLockManager, configuration: CliUnlockConfiguration): """ Unlocks a lock. :param lock_manager: the lock manager :param configuration: the configuration required to unlock the lock """ if configuration.regex_key_enabled: release_information = sorted(list(lock_manager.release_regex(key_regex=configuration.key))) else: release_information = lock_manager.release(key=configuration.key) print(json.dumps(release_information)) exit(SUCCESS_EXIT_CODE)
def release(service: ConsulDockerisedService): lock_manager = ConsulLockManager(consul_client=service.create_consul_client()) released_locks = lock_manager.release_regex(KEYS_1_REGEX) self.assertCountEqual(KEYS_1, released_locks)
def release(service: ConsulDockerisedService): lock_manager = ConsulLockManager( consul_client=service.create_consul_client()) released_locks = lock_manager.release_regex(KEYS_1_REGEX) self.assertCountEqual(KEYS_1, released_locks)