Add Technical_Decomp_Systemd
parent
04063a2503
commit
598ab639e9
1 changed files with 66 additions and 0 deletions
66
Technical_Decomp_Systemd.md
Normal file
66
Technical_Decomp_Systemd.md
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
## enroll/systemd.py
|
||||||
|
|
||||||
|
### UnitInfo (dataclass)
|
||||||
|
|
||||||
|
#### Purpose: parsed subset of systemctl show <unit> for services.
|
||||||
|
|
||||||
|
#### Fields:
|
||||||
|
|
||||||
|
- name: unit name
|
||||||
|
- fragment_path: main unit file path
|
||||||
|
- dropin_paths: list of drop-in config files
|
||||||
|
- env_files: resolved EnvironmentFiles entries (minus leading -)
|
||||||
|
- exec_paths: parsed executable paths from ExecStart
|
||||||
|
- active_state, sub_state, unit_file_state, condition_result
|
||||||
|
|
||||||
|
#### Lifecycle / where it’s used:
|
||||||
|
|
||||||
|
- Returned by get_unit_info().
|
||||||
|
- harvest.harvest() uses it to:
|
||||||
|
- infer packages (dpkg_owner on fragment + exec binaries)
|
||||||
|
- add /etc/... candidates from dropins/env files
|
||||||
|
|
||||||
|
__________________
|
||||||
|
|
||||||
|
### UnitQueryError (exception class)
|
||||||
|
|
||||||
|
#### Purpose: a structured error when systemctl show fails for a unit.
|
||||||
|
|
||||||
|
#### Fields set in __init__:
|
||||||
|
|
||||||
|
- unit: unit name that failed
|
||||||
|
- stderr: trimmed stderr text
|
||||||
|
|
||||||
|
#### Message:
|
||||||
|
|
||||||
|
systemctl show failed for <unit>: <stderr>
|
||||||
|
|
||||||
|
#### Lifecycle / where it’s used:
|
||||||
|
|
||||||
|
Raised by get_unit_info() if systemctl returns nonzero.
|
||||||
|
|
||||||
|
harvest.harvest() catches it and records a ServiceSnapshot with empty packages/files and a note containing the error string.
|
||||||
|
|
||||||
|
____________________
|
||||||
|
|
||||||
|
### TimerInfo (dataclass)
|
||||||
|
|
||||||
|
#### Purpose: parsed subset of systemctl show <unit> for timers.
|
||||||
|
|
||||||
|
#### Fields:
|
||||||
|
|
||||||
|
- name
|
||||||
|
- fragment_path
|
||||||
|
- dropin_paths
|
||||||
|
- env_files
|
||||||
|
- trigger_unit: parsed from Unit= field (what the timer triggers)
|
||||||
|
- active_state, sub_state, unit_file_state, condition_result
|
||||||
|
|
||||||
|
#### Lifecycle / where it’s used:
|
||||||
|
|
||||||
|
Returned by get_timer_info().
|
||||||
|
|
||||||
|
harvest.harvest() uses timers to attribute timer override files under /etc to:
|
||||||
|
- the triggered service role (preferred), else
|
||||||
|
- a package role, else
|
||||||
|
- let it fall through and potentially get captured by etc_custom.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue