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:
|
class SystemdReloadMixin:
|
||||||
module: basic.AnsibleModule
|
module: basic.AnsibleModule
|
||||||
unitfile: pathlib.Path
|
unitfile: pathlib.Path
|
||||||
|
restartable: bool = True
|
||||||
changed: bool
|
changed: bool
|
||||||
def post(self):
|
def post(self):
|
||||||
if not self.changed:
|
if not self.changed:
|
||||||
return
|
return
|
||||||
systemctl = self.module.get_bin_path("systemctl", required=True)
|
systemctl = self.module.get_bin_path("systemctl", required=True)
|
||||||
self.module.run_command([systemctl, "daemon-reload"], check_rc=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
|
return
|
||||||
(rc, _, _) = self.module.run_command([systemctl, "is-enabled", self.unitfile.name], check_rc=False)
|
(rc, _, _) = self.module.run_command([systemctl, "is-enabled", self.unitfile.name], check_rc=False)
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
|
|
Laden…
In neuem Issue referenzieren