diff --git a/pyproject.toml b/pyproject.toml index 38dde2373..ee91d4b28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ antsibull-lint = "antsibull.cli.antsibull_lint:main" [tool.poetry.dependencies] python = "^3.6.1" antsibull-changelog = ">= 0.14.0" -antsibull-core = ">= 1.0.0, < 2.0.0" +antsibull-core = ">= 1.2.0, < 2.0.0" antsibull-docs = ">= 1.0.0, < 2.0.0" asyncio-pool = "*" jinja2 = "*" diff --git a/src/antsibull/cli/antsibull_build.py b/src/antsibull/cli/antsibull_build.py index 1d680d617..c81726a09 100644 --- a/src/antsibull/cli/antsibull_build.py +++ b/src/antsibull/cli/antsibull_build.py @@ -23,7 +23,7 @@ from antsibull_core.args import ( # noqa: E402 InvalidArgumentError, get_toplevel_parser, normalize_toplevel_options ) -from antsibull_core.config import load_config # noqa: E402 +from antsibull_core.config import ConfigError, load_config # noqa: E402 from ..build_collection import build_collection_command # noqa: E402 from ..build_ansible_commands import ( # noqa: E402 @@ -384,14 +384,19 @@ def run(args: List[str]) -> int: print(e) return 2 - cfg = load_config(parsed_args.config_file) - flog.fields(config=cfg).info('Config loaded') + try: + cfg = load_config(parsed_args.config_file) + flog.fields(config=cfg).info('Config loaded') + except ConfigError as e: + print(e) + return 2 context_data = app_context.create_contexts(args=parsed_args, cfg=cfg) with app_context.app_and_lib_context(context_data) as (app_ctx, dummy_): twiggy.dict_config(app_ctx.logging_cfg.dict()) flog.debug('Set logging config') + flog.fields(command=parsed_args.command).info('Action') return ARGS_MAP[parsed_args.command]()