From 74f58c59c9c2405d431a401f376968862e448dac Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sat, 27 Jan 2024 20:56:00 +0100 Subject: [PATCH] fix: strip builtin fqc prefix from task action (#759) --- ansiblelater/rules/CheckFilePermissionOctal.py | 4 ++-- ansiblelater/utils/yamlhelper.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ansiblelater/rules/CheckFilePermissionOctal.py b/ansiblelater/rules/CheckFilePermissionOctal.py index 903d45a..1ef6f87 100644 --- a/ansiblelater/rules/CheckFilePermissionOctal.py +++ b/ansiblelater/rules/CheckFilePermissionOctal.py @@ -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): diff --git a/ansiblelater/utils/yamlhelper.py b/ansiblelater/utils/yamlhelper.py index a49ad45..b4ae92e 100644 --- a/ansiblelater/utils/yamlhelper.py +++ b/ansiblelater/utils/yamlhelper.py @@ -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()