Fix podman-restart.service when there are no containers

If no containers need to be restarted, podman-restart prints "Error: you must provide at least one name or id" then fails.

Update the service file to handle start and stop symmetrically.

See discussion in https://github.com/containers/podman/pull/25131

Signed-off-by: Andrew Sayers <andrew-github.com@pileofstuff.org>
This commit is contained in:
Andrew Sayers
2025-01-27 14:53:35 +00:00
committed by GitHub
parent 9403c3d98d
commit 527a51dcc4

View File

@ -10,7 +10,7 @@ Type=oneshot
RemainAfterExit=true
Environment=LOGGING="--log-level=info"
ExecStart=@@PODMAN@@ $LOGGING start --all --filter restart-policy=always
ExecStop=/bin/sh -c '@@PODMAN@@ $LOGGING stop $(@@PODMAN@@ container ls --filter restart-policy=always -q)'
ExecStop=@@PODMAN@@ $LOGGING stop --all --filter restart-policy=always
[Install]
WantedBy=default.target