From c4d406f1386c3fa2dca96c39d974bb15239d6e34 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Wed, 31 May 2023 10:19:45 +0200 Subject: [PATCH] fix: call init_plugin_loader to fix module loading during module arg parse (#612) --- ansiblelater/utils/yamlhelper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ansiblelater/utils/yamlhelper.py b/ansiblelater/utils/yamlhelper.py index 1b05508..57fcb42 100644 --- a/ansiblelater/utils/yamlhelper.py +++ b/ansiblelater/utils/yamlhelper.py @@ -69,7 +69,8 @@ def ansible_template(basedir, varname, templatevars, **kwargs): try: from ansible.plugins import module_loader except ImportError: - from ansible.plugins.loader import module_loader + from ansible.plugins.loader import init_plugin_loader, module_loader + init_plugin_loader() LINE_NUMBER_KEY = "__line__" FILENAME_KEY = "__file__" @@ -411,7 +412,7 @@ def normalize_task(task, filename, custom_modules=None): try: action, arguments, normalized["delegate_to"] = mod_arg_parser.parse() except AnsibleParserError as e: - raise LaterAnsibleError("syntax error", e) from e + raise LaterAnsibleError(e) from e # denormalize shell -> command conversion if "_uses_shell" in arguments: