From e3bf82d873f223e874016db172488f239a67a7cf Mon Sep 17 00:00:00 2001 From: Thomas Woerner Date: Mon, 9 Jan 2023 17:36:56 +0100 Subject: [PATCH 1/2] utils/galaxyfy.py: Support builtins with ansible.builtin. prefix The ansible builtins are using the ansible.builtin. prefix now, but galaxyfy was not supporting the prefix. Therefore vars in set_fact tasks got the collection prefix and include_role tasks have not been handled correctly. --- utils/galaxyfy.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/galaxyfy.py b/utils/galaxyfy.py index cdca17a8..bc5c16da 100644 --- a/utils/galaxyfy.py +++ b/utils/galaxyfy.py @@ -39,13 +39,14 @@ def galaxyfy_playbook(project_prefix, collection_prefix, lines): if stripped.startswith("- name:") or \ stripped.startswith("- block:"): changeable = True - elif stripped in ["set_fact:", "vars:"]: + elif stripped in ["set_fact:", "ansible.builtin.set_fact:", "vars:"]: changeable = False include_role = False elif stripped == "roles:": changeable = True include_role = False - elif stripped.startswith("include_role:"): + elif (stripped.startswith("include_role:") or + stripped.startswith("ansible.builtin.include_role:")): include_role = True elif include_role and stripped.startswith("name:"): line = po2.sub(pattern2, line) From b7608638478a296df5b51b47be2f731a410d18da Mon Sep 17 00:00:00 2001 From: Thomas Woerner Date: Mon, 9 Jan 2023 18:04:07 +0100 Subject: [PATCH 2/2] utils/get_test_modules.py: Support ansible.builtin. prefix The ansible.builtin. prefix was not supported. Therefore tasks have not been identified properly. --- utils/get_test_modules.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/get_test_modules.py b/utils/get_test_modules.py index d3f4c043..1e7518c5 100644 --- a/utils/get_test_modules.py +++ b/utils/get_test_modules.py @@ -27,7 +27,9 @@ def get_plugins_from_playbook(playbook): task = task.split(".")[-1] if task == "block": _result.update(get_tasks(tasks["block"])) - elif task in ["include_tasks", "import_tasks"]: + elif task in ["include_tasks", "import_tasks" + "ansible.builtin.include_tasks", + "ansible.builtin.import_tasks"]: parent = os.path.dirname(playbook) include_task = tasks[task] if isinstance(include_task, dict): @@ -37,7 +39,8 @@ def get_plugins_from_playbook(playbook): else: include_file = os.path.join(parent, include_task) _result.update(get_plugins_from_playbook(include_file)) - elif task == "include_role": + elif task in ["include_role", + "ansible.builtin.include_role"]: _result.add(f"_{tasks[original_task]['name']}") elif task.startswith("ipa"): # assume we are only interested in 'ipa*' modules/roles