Skip to content

Commit

Permalink
fix module FQCN issue for import modules (ansible#220)
Browse files Browse the repository at this point in the history
Signed-off-by: hirokuni-kitahara <[email protected]>
  • Loading branch information
hirokuni-kitahara authored and justjais committed Jun 3, 2024
1 parent c48a069 commit b80457c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ansible_risk_insight/rules/P001_module_name_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,20 @@ def process(self, ctx: AnsibleRunContext):

# include_role, import_role
elif task.spec.executable_type == ExecutableType.ROLE_TYPE:
if "ansible.builtin." not in task.spec.module:
if "ansible.builtin." in task.spec.module:
resolved_fqcn = task.spec.module
correct_fqcn = resolved_fqcn
else:
resolved_fqcn = "ansible.builtin." + task.spec.module
correct_fqcn = resolved_fqcn
need_correction = True

# include_tasks, import_tasks
elif task.spec.executable_type == ExecutableType.TASKFILE_TYPE:
if "ansible.builtin." not in task.spec.module:
if "ansible.builtin." in task.spec.module:
resolved_fqcn = task.spec.module
correct_fqcn = resolved_fqcn
else:
resolved_fqcn = "ansible.builtin." + task.spec.module
correct_fqcn = resolved_fqcn
need_correction = True
Expand Down

0 comments on commit b80457c

Please sign in to comment.