Locks a lock then exits.
    :param lock_manager: the lock manager
    :param configuration: the configuration required to lock the lock

def _acquire_lock_and_exit(lock_manager: ConsulLockManager, configuration: CliLockConfiguration):
    """
    Locks a lock then exits.
    :param lock_manager: the lock manager
    :param configuration: the configuration required to lock the lock
    """
    lock = _acquire_lock(lock_manager, configuration)
    print(json.dumps(lock, cls=ConsulLockInformationJSONEncoder, sort_keys=True))

    if lock is None:
        logger.error(f"Unable to acquire lock: {configuration.key}")
        exit(UNABLE_TO_ACQUIRE_LOCK_EXIT_CODE)

    exit(SUCCESS_EXIT_CODE)