1
0
Fork 0

some formatting

Dieser Commit ist enthalten in:
Sebastian Tobie 2023-04-21 00:15:03 +02:00
Ursprung bbf9daa8a7
Commit 53057c18a2
1 geänderte Dateien mit 3 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -80,9 +80,7 @@ class AnsibleModule(object):
if after_header is not None: if after_header is not None:
diff["after_header"] = after_header diff["after_header"] = after_header
else: else:
raise TypeError( raise TypeError("only diff or before and after can be set, not both of them")
"only diff or before and after can be set, not both of them"
)
self.result["diff"].append(diff) self.result["diff"].append(diff)
def get(self, key: str, default: T = None) -> T: def get(self, key: str, default: T = None) -> T:
@ -265,14 +263,10 @@ class SystemdUnitModule(AnsibleModule):
def check(self): def check(self):
self.unitfile_gen() self.unitfile_gen()
if not self.unitfile.exists(): if not self.unitfile.exists():
self.diff( self.diff(before="", after=self.unit(), before_header=self.unitfile.as_posix())
before="", after=self.unit(), before_header=self.unitfile.as_posix()
)
self.changed = True self.changed = True
else: else:
if self.module.sha256(self.unitfile.as_posix()) != self.module.sha256( if self.module.sha256(self.unitfile.as_posix()) != self.module.sha256((self.tmpdir / "newunit").as_posix()):
(self.tmpdir / "newunit").as_posix()
):
self.changed = True self.changed = True
self.diff( self.diff(
before=self.unitfile.read_text(), before=self.unitfile.read_text(),