From: Aleš Mrázek Date: Thu, 15 Jun 2023 10:14:10 +0000 (+0200) Subject: manager: cli: convert: set global validation context X-Git-Tag: v6.0.1~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52ab83edda5802b4e06d813bfa42c590c42c7a9c;p=thirdparty%2Fknot-resolver.git manager: cli: convert: set global validation context --- diff --git a/manager/knot_resolver_manager/cli/cmd/convert.py b/manager/knot_resolver_manager/cli/cmd/convert.py index ac9218591..fc09db543 100644 --- a/manager/knot_resolver_manager/cli/cmd/convert.py +++ b/manager/knot_resolver_manager/cli/cmd/convert.py @@ -1,9 +1,11 @@ import argparse import sys +from pathlib import Path from typing import List, Optional, Tuple, Type from knot_resolver_manager.cli.command import Command, CommandArgs, CompWords, register_command from knot_resolver_manager.datamodel import KresConfig +from knot_resolver_manager.datamodel.globals import Context, set_global_validation_context from knot_resolver_manager.utils.modeling import try_to_parse from knot_resolver_manager.utils.modeling.exceptions import DataParsingError, DataValidationError @@ -46,6 +48,7 @@ class ConvertCommand(Command): try: parsed = try_to_parse(data) + set_global_validation_context(Context(resolve_directory=Path(self.input_file).parent)) lua = KresConfig(parsed).render_lua() except (DataParsingError, DataValidationError) as e: print(e)