Add `--plain` and `--no-legend` to the command to list service units.
This fixes a bug where a service could be prefixed with a unique
character, resulting undetected services.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
The `update_service_status()` method could result in the creation of multiple subprocesses for each update, resulting in a performance hit as subprocesses are inherently expensive.
Fetch the state for all detected services in a single subprocess.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Most containers do not have access to systemd, so using
systemd-detect-virt will fail. We can check the cgroup
and sched files of the first process to reliably determine
if Moonraker is running within a container.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
It isn't valid to run some commands from within containers. Use systmd-detect-virt to detect a virtualized environment and report the type and id via the system_info endpoint.
If Moonraker is running from within a container do not allow access to the reboot and shutdown endpoints.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This resolves an issue where an allowed service is not
tagged as available if it is not loaded when moonraker
starts.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Systemd units are case sensitive, do not convert the "name" argument for service requests to lower case.
Signed-off-by: Eric Callahan <arksine.code@gmail.com>