Skip to content
Snippets Groups Projects
Unverified Commit f8b58516 authored by Rafael Guterres Jeffman's avatar Rafael Guterres Jeffman Committed by GitHub
Browse files

Merge pull request #1016 from t-woerner/galaxyfy_ansible_builtin

utils files: Support builtins with ansible.builtin. prefix
parents 76ca587d b7608638
No related branches found
No related tags found
No related merge requests found
...@@ -39,13 +39,14 @@ def galaxyfy_playbook(project_prefix, collection_prefix, lines): ...@@ -39,13 +39,14 @@ def galaxyfy_playbook(project_prefix, collection_prefix, lines):
if stripped.startswith("- name:") or \ if stripped.startswith("- name:") or \
stripped.startswith("- block:"): stripped.startswith("- block:"):
changeable = True changeable = True
elif stripped in ["set_fact:", "vars:"]: elif stripped in ["set_fact:", "ansible.builtin.set_fact:", "vars:"]:
changeable = False changeable = False
include_role = False include_role = False
elif stripped == "roles:": elif stripped == "roles:":
changeable = True changeable = True
include_role = False include_role = False
elif stripped.startswith("include_role:"): elif (stripped.startswith("include_role:") or
stripped.startswith("ansible.builtin.include_role:")):
include_role = True include_role = True
elif include_role and stripped.startswith("name:"): elif include_role and stripped.startswith("name:"):
line = po2.sub(pattern2, line) line = po2.sub(pattern2, line)
......
...@@ -27,7 +27,9 @@ def get_plugins_from_playbook(playbook): ...@@ -27,7 +27,9 @@ def get_plugins_from_playbook(playbook):
task = task.split(".")[-1] 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"
"ansible.builtin.include_tasks",
"ansible.builtin.import_tasks"]:
parent = os.path.dirname(playbook) parent = os.path.dirname(playbook)
include_task = tasks[task] include_task = tasks[task]
if isinstance(include_task, dict): if isinstance(include_task, dict):
...@@ -37,7 +39,8 @@ def get_plugins_from_playbook(playbook): ...@@ -37,7 +39,8 @@ def get_plugins_from_playbook(playbook):
else: else:
include_file = os.path.join(parent, include_task) include_file = os.path.join(parent, include_task)
_result.update(get_plugins_from_playbook(include_file)) _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']}") _result.add(f"_{tasks[original_task]['name']}")
elif task.startswith("ipa"): elif task.startswith("ipa"):
# assume we are only interested in 'ipa*' modules/roles # assume we are only interested in 'ipa*' modules/roles
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment