added the ability for the author of the module to decide if the module is not restartable/needs restarts
Dieser Commit ist enthalten in:
Ursprung
20bb6b1f16
Commit
3e0cb17222
|
@ -350,13 +350,14 @@ def installable(_class: Type[SystemdUnitModule]):
|
|||
class SystemdReloadMixin:
|
||||
module: basic.AnsibleModule
|
||||
unitfile: pathlib.Path
|
||||
restartable: bool = True
|
||||
changed: bool
|
||||
def post(self):
|
||||
if not self.changed:
|
||||
return
|
||||
systemctl = self.module.get_bin_path("systemctl", required=True)
|
||||
self.module.run_command([systemctl, "daemon-reload"], check_rc=True)
|
||||
if self.unitfile.stem.endswith("@"):
|
||||
if self.unitfile.stem.endswith("@") or not self.restartable:
|
||||
return
|
||||
(rc, _, _) = self.module.run_command([systemctl, "is-enabled", self.unitfile.name], check_rc=False)
|
||||
if rc == 0:
|
||||
|
|
Laden…
In neuem Issue referenzieren