rename and fix rule CheckFilePermissionMissing

This commit is contained in:
Robert Kaussow 2021-01-31 12:35:57 +01:00
parent bf3908ac36
commit 6f2a06357f
No known key found for this signature in database
GPG Key ID: 65362AE74AF98B61

View File

@ -20,7 +20,7 @@
from ansiblelater.standard import StandardBase
class CheckMissingFilePermission(StandardBase):
class CheckFilePermissionMissing(StandardBase):
sid = "ANSIBLE0018"
description = "File permissions unset or incorrect"
@ -55,7 +55,7 @@ class CheckMissingFilePermission(StandardBase):
if not errors:
for task in tasks:
if not self._check_mode(task):
if self._check_mode(task):
errors.append(
self.Error(
task["__line__"],
@ -82,7 +82,7 @@ class CheckMissingFilePermission(StandardBase):
create = task["action"].get("create", self._create_modules[module])
return create and mode is None
# A file that doesn"t exist cannot have a mode
# A file that doesn't exist cannot have a mode
if task["action"].get("state", None) == "absent":
return False
@ -95,8 +95,7 @@ class CheckMissingFilePermission(StandardBase):
return False
# The file module does not create anything when state==file (default)
if module == "file" and \
task["action"].get("state", "file") == "file":
if module == "file" and task["action"].get("state", "file") == "file":
return False
# replace module is the only one that has a valid default preserve