Compare commits
5 Commits
c7d5b254e8
...
42744bf4b9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
42744bf4b9 | ||
| ab562fe600 | |||
|
|
b96152acca | ||
| cc560770ce | |||
| 4df903783c |
10
debian/changelog
vendored
10
debian/changelog
vendored
@@ -1,3 +1,11 @@
|
|||||||
|
revpi-middleware (0.0.5-1+deb12+1) bookworm; urgency=medium
|
||||||
|
|
||||||
|
* fix(revpiconfig): Ensure systemd reloads after unit changes
|
||||||
|
* feat(revpiconfig): Make unit config changes asynchronous
|
||||||
|
* Update changelog for 0.0.4-1+deb12+1 release
|
||||||
|
|
||||||
|
-- Sven Sager <s.sager@kunbus.com> Tue, 22 Apr 2025 13:44:45 +0200
|
||||||
|
|
||||||
revpi-middleware (0.0.4-1+deb12+1) bookworm; urgency=medium
|
revpi-middleware (0.0.4-1+deb12+1) bookworm; urgency=medium
|
||||||
|
|
||||||
* fix(dbus): Update DBus policy file path and interface name
|
* fix(dbus): Update DBus policy file path and interface name
|
||||||
@@ -7,7 +15,7 @@ revpi-middleware (0.0.4-1+deb12+1) bookworm; urgency=medium
|
|||||||
* doc(revpiconfig): Add docstrings to enums in `revpi_config.py`
|
* doc(revpiconfig): Add docstrings to enums in `revpi_config.py`
|
||||||
* doc(revpiconfig): Docstrings for `get_rfkill_index` and `simple_systemd`
|
* doc(revpiconfig): Docstrings for `get_rfkill_index` and `simple_systemd`
|
||||||
|
|
||||||
-- Sven Sager <s.sager@kunbus.com> Tue, 22 Apr 2025 11:08:12 +0200
|
-- Sven Sager <s.sager@kunbus.com> Tue, 22 Apr 2025 13:43:53 +0200
|
||||||
|
|
||||||
revpi-middleware (0.0.3-1+deb12+1) bookworm; urgency=medium
|
revpi-middleware (0.0.3-1+deb12+1) bookworm; urgency=medium
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ from glob import glob
|
|||||||
from logging import getLogger
|
from logging import getLogger
|
||||||
from os import X_OK, access
|
from os import X_OK, access
|
||||||
from os.path import exists, join
|
from os.path import exists, join
|
||||||
|
from threading import Thread
|
||||||
from typing import List, Optional
|
from typing import List, Optional
|
||||||
|
|
||||||
from pydbus import SystemBus
|
from pydbus import SystemBus
|
||||||
@@ -665,13 +666,39 @@ def simple_systemd(action: ConfigActions, unit: str):
|
|||||||
systemd_manager = systemd["org.freedesktop.systemd1.Manager"]
|
systemd_manager = systemd["org.freedesktop.systemd1.Manager"]
|
||||||
|
|
||||||
if action is ConfigActions.ENABLE:
|
if action is ConfigActions.ENABLE:
|
||||||
systemd_manager.UnmaskUnitFiles([unit], False)
|
|
||||||
systemd_manager.EnableUnitFiles([unit], False, False)
|
def thread_unit_config():
|
||||||
|
"""Change configuration asynchronously."""
|
||||||
|
# Dbus call: UnmaskUnitFiles(in as files, in b runtime, out a(sss) changes
|
||||||
|
lst_change_unmask = systemd_manager.UnmaskUnitFiles([unit], False)
|
||||||
|
|
||||||
|
# Dbus call: EnableUnitFiles(in as files, in b runtime, in b force,
|
||||||
|
# out b carries_install_info, out a(sss) changes
|
||||||
|
lst_change_enable = systemd_manager.EnableUnitFiles([unit], False, False)
|
||||||
|
if lst_change_unmask or lst_change_enable:
|
||||||
|
# Reload systemd after modified unit property
|
||||||
|
systemd_manager.Reload()
|
||||||
|
|
||||||
|
Thread(target=thread_unit_config, daemon=True).start()
|
||||||
|
|
||||||
|
# Dbus call: StartUnit(in s name, in s mode, out o job
|
||||||
systemd_manager.StartUnit(unit, "replace")
|
systemd_manager.StartUnit(unit, "replace")
|
||||||
|
|
||||||
elif action is ConfigActions.DISABLE:
|
elif action is ConfigActions.DISABLE:
|
||||||
|
|
||||||
|
def thread_unit_config():
|
||||||
|
"""Change configuration asynchronously."""
|
||||||
|
# Dbus call: DisableUnitFiles (in as files, in b runtime, out a(sss) changes)
|
||||||
|
change = systemd_manager.DisableUnitFiles([unit], False)
|
||||||
|
if change:
|
||||||
|
# Reload systemd after modified unit property
|
||||||
|
systemd_manager.Reload()
|
||||||
|
|
||||||
|
Thread(target=thread_unit_config, daemon=True).start()
|
||||||
|
|
||||||
|
# Dbus call: StopUnit(in s name,in s mode, out o job
|
||||||
systemd_manager.StopUnit(unit, "replace")
|
systemd_manager.StopUnit(unit, "replace")
|
||||||
systemd_manager.DisableUnitFiles([unit], False)
|
|
||||||
|
|
||||||
elif action is ConfigActions.STATUS:
|
elif action is ConfigActions.STATUS:
|
||||||
try:
|
try:
|
||||||
@@ -696,6 +723,8 @@ def simple_systemd(action: ConfigActions, unit: str):
|
|||||||
else:
|
else:
|
||||||
raise ValueError(f"action {action} not supported")
|
raise ValueError(f"action {action} not supported")
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
rc = RevPiConfig()
|
rc = RevPiConfig()
|
||||||
|
|||||||
Reference in New Issue
Block a user