orangeqs.juice.orchestration.systemd#
Systemd utilities.
Module Contents#
Classes#
A systemd unit that failed, with its log. |
Functions#
Find the failed units and get the last lines of the log of their last run. |
|
Reload the systemd daemon. |
|
Restart multiple systemd services. |
|
Start a systemd service. |
|
Enable a systemd service. |
Data#
Number of log lines of a failed unit to show to the user. |
API#
- orangeqs.juice.orchestration.systemd.TAIL_LINES#
30
Number of log lines of a failed unit to show to the user.
- class orangeqs.juice.orchestration.systemd.FailedUnit#
A systemd unit that failed, with its log.
Attributes#
name (str): Full name of the unit, for example
juice-foo-build.service.tail (list[str]): The last lines of the log of the last run of the unit.
- exception orangeqs.juice.orchestration.systemd.UnitFailedError(message: str, units: list[orangeqs.juice.orchestration.systemd.FailedUnit])#
Bases:
RuntimeErrorOne or more systemd units failed to start or restart.
Parameters#
message (str): Short description of the failure.
units (list[FailedUnit]): The units that failed, with their logs.
- orangeqs.juice.orchestration.systemd.collect_failed_units(service_names: list[str]) list[orangeqs.juice.orchestration.systemd.FailedUnit]#
Find the failed units and get the last lines of the log of their last run.
Parameters#
service_names (list[str]): The units to check.
Returns#
(list[FailedUnit]): The units that failed. Empty if no unit has failed.
- orangeqs.juice.orchestration.systemd.restart_services(service_names: str | list[str]) None#
Restart multiple systemd services.
Raises#
(UnitFailedError): If one or more units failed. It contains the log of each failed unit.
(RuntimeError): If
systemctlfailed for another reason.