Skip to content
Snippets Groups Projects
Commit c71a2b33 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman
Browse files

upstream CI: Fix test selection for CheckPR pipeline.

Due to an error on processing Ansible key 'import_tasks' the script that
creates a list of modules to test is broken making some modules to be
not tested.

By fixing the handling of 'import_tasks' and module import, the list is
correct again and the list of modules to be tested now include the ones
which depend on the modified module.
parent 02223dfb
No related branches found
No related tags found
No related merge requests found
...@@ -23,8 +23,6 @@ def get_plugins_from_playbook(playbook): ...@@ -23,8 +23,6 @@ def get_plugins_from_playbook(playbook):
for tasks in task_block: for tasks in task_block:
for task in tasks: for task in tasks:
original_task = task original_task = task
if "." in task:
task = task.split(".")[-1]
if task == "block": if task == "block":
_result.update(get_tasks(tasks["block"])) _result.update(get_tasks(tasks["block"]))
elif task in ["include_tasks", "import_tasks" elif task in ["include_tasks", "import_tasks"
...@@ -127,8 +125,16 @@ def parse_playbooks(test_module): ...@@ -127,8 +125,16 @@ def parse_playbooks(test_module):
"builtins.__import__", side_effect=import_mock "builtins.__import__", side_effect=import_mock
): ):
# pylint: disable=no-value-for-parameter # pylint: disable=no-value-for-parameter
try:
loader = SourceFileLoader(playbook, source) loader = SourceFileLoader(playbook, source)
loader.exec_module(types.ModuleType(loader.name)) loader.exec_module(
types.ModuleType(loader.name)
)
except Exception: # pylint: disable=broad-except
# If import fails, we'll assume there's no
# plugin to be loaded. This is of little risk
# it is rare that a plugin includes another.
pass
# pylint: disable=no-member # pylint: disable=no-member
candidates = [ candidates = [
f.split(".")[1:] f.split(".")[1:]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment