sudoers: fix handling of state: absent (#4852) (#4853) (#4857)

* sudoers: fix handling of state: absent (#4852)

* typo fixes

(cherry picked from commit 44e21dd407)

Co-authored-by: s-hamann <10639154+s-hamann@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-06-19 15:48:53 +02:00 committed by GitHub
parent 48fbd69835
commit f8650f8d85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View file

@ -168,9 +168,12 @@ class Sudoers(object):
return "{owner} ALL={runas}{nopasswd} {commands}\n".format(owner=owner, runas=runas_str, nopasswd=nopasswd_str, commands=commands_str)
def run(self):
if self.state == 'absent' and self.exists():
self.delete()
return True
if self.state == 'absent':
if self.exists():
self.delete()
return True
else:
return False
if self.exists() and self.matches():
return False