fix: strip builtin fqc prefix from task action (#759)

This commit is contained in:
Robert Kaussow 2024-01-27 20:56:00 +01:00 committed by GitHub
parent da5d3c21c2
commit 74f58c59c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

@ -23,8 +23,8 @@ from ansiblelater.rule import RuleBase
class CheckFilePermissionOctal(RuleBase):
rid = "ANS119"
description = "Numeric file permissions without leading zero can behave in unexpected ways"
helptext = '`mode: {mode}` should be strings with a leading zero `mode: "0{mode}"'
description = "Numeric file permissions without a leading zero can behave unexpectedly"
helptext = '`mode: {mode}` should be strings with a leading zero `mode: "0{mode}"`'
types = ["playbook", "task", "handler"]
def check(self, candidate, settings):

View File

@ -411,7 +411,9 @@ def normalize_task(task, filename, custom_modules=None):
normalized[k] = v
normalized["action"] = {"__ansible_module__": action}
# convert builtin fqn calls to short forms because most rules know only
# about short calls
normalized["action"] = {"__ansible_module__": action.removeprefix("ansible.builtin.")}
if "_raw_params" in arguments:
normalized["action"]["__ansible_arguments__"] = arguments["_raw_params"].strip().split()