chore: improve desc and help for CheckFilePermissionOctal

This commit is contained in:
Robert Kaussow 2024-01-27 19:59:45 +01:00
parent 2f4e35d83c
commit 7b44647bec
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
1 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 = "Octal file permissions must contain leading zero or be a string"
helptext = "numeric file permissions without leading zero can behave in unexpected ways"
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}"'
types = ["playbook", "task", "handler"]
def check(self, candidate, settings):
@ -47,7 +47,9 @@ class CheckFilePermissionOctal(RuleBase):
mode = task["action"].get("mode", None)
if isinstance(mode, int) and self._is_invalid_permission(mode):
errors.append(self.Error(task["__line__"], self.helptext))
errors.append(
self.Error(task["__line__"], self.helptext.format(mode=mode))
)
return self.Result(candidate.path, errors)