Merge pull request #248315 from apeschar/oci-containers-backend-stop
nixos/oci-containers: stop container using backend
This commit is contained in:
commit
c43fd32e03
2 changed files with 9 additions and 3 deletions
|
@ -308,9 +308,10 @@ let
|
|||
);
|
||||
|
||||
preStop = if cfg.backend == "podman"
|
||||
then "[ $SERVICE_RESULT = success ] || podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
|
||||
else "[ $SERVICE_RESULT = success ] || ${cfg.backend} stop ${name}";
|
||||
postStop = if cfg.backend == "podman"
|
||||
then "podman stop --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
|
||||
else "${cfg.backend} stop ${name}";
|
||||
|
||||
postStop = if cfg.backend == "podman"
|
||||
then "podman rm -f --ignore --cidfile=/run/podman-${escapedName}.ctr-id"
|
||||
else "${cfg.backend} rm -f ${name} || true";
|
||||
|
||||
|
|
|
@ -24,6 +24,10 @@ let
|
|||
ports = ["8181:80"];
|
||||
};
|
||||
};
|
||||
|
||||
# Stop systemd from killing remaining processes if ExecStop script
|
||||
# doesn't work, so that proper stopping can be tested.
|
||||
systemd.services."${backend}-nginx".serviceConfig.KillSignal = "SIGCONT";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -32,6 +36,7 @@ let
|
|||
${backend}.wait_for_unit("${backend}-nginx.service")
|
||||
${backend}.wait_for_open_port(8181)
|
||||
${backend}.wait_until_succeeds("curl -f http://localhost:8181 | grep Hello")
|
||||
${backend}.succeed("systemctl stop ${backend}-nginx.service", timeout=10)
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue