Merge pull request #90604 from maralorn/systemd-oneshot-warning

nixos/systemd: Update warning for restarting oneshots
This commit is contained in:
Florian Klink 2020-06-16 23:35:22 +02:00 committed by GitHub
commit d72530162a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -826,8 +826,13 @@ in
config = {
warnings = concatLists (mapAttrsToList (name: service:
optional (service.serviceConfig.Type or "" == "oneshot" && service.serviceConfig.Restart or "no" != "no")
"Service ${name}.service with Type=oneshot must have Restart=no") cfg.services);
let
type = service.serviceConfig.Type or "";
restart = service.serviceConfig.Restart or "no";
in optional
(type == "oneshot" && (restart == "always" || restart == "on-success"))
"Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'")
cfg.services);
system.build.units = cfg.units;