mirror of https://github.com/containers/podman.git
Podmansh: Better error, increase timeout to 30s
Co-authored-by: Ed Santiago <santiago@redhat.com> Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
parent
34a2a48e9c
commit
6df17332b5
|
@ -150,7 +150,9 @@ func exec(cmd *cobra.Command, args []string) error {
|
|||
return err
|
||||
}
|
||||
if err := execWait(nameOrID, seconds); err != nil {
|
||||
return err
|
||||
if errors.Is(err, define.ErrCanceled) {
|
||||
return fmt.Errorf("timed out waiting for container: %s", nameOrID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@ func main() {
|
|||
if filepath.Base(os.Args[0]) == registry.PodmanSh ||
|
||||
(len(os.Args[0]) > 0 && filepath.Base(os.Args[0][1:]) == registry.PodmanSh) {
|
||||
shell := strings.TrimPrefix(os.Args[0], "-")
|
||||
args := []string{shell, "exec", "-i", "--wait", "10"}
|
||||
|
||||
// The wait timeout will soon be made configurable via the
|
||||
// upcoming `podmansh_timeout` option in containers.conf
|
||||
args := []string{shell, "exec", "-i", "--wait", "30"}
|
||||
if term.IsTerminal(0) || term.IsTerminal(1) || term.IsTerminal(2) {
|
||||
args = append(args, "-t")
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ podmansh - Execute login shell within the Podman `podmansh` container
|
|||
|
||||
Execute a user shell within a container when the user logs into the system. The container that the users get added to can be defined via a Podman Quadlet file. This user only has access to volumes and capabilities configured into the Quadlet file.
|
||||
|
||||
Administrators can create a Quadlet in /etc/containers/systemd/users, which systemd will start for all users when they log in. The administrator can create a specific Quadlet with the container name `podmansh`, then enable users to use the login shell /usr/bin/podmansh. These user login shells are automatically executed inside the `podmansh` container via Podman. .
|
||||
Administrators can create a Quadlet in /etc/containers/systemd/users, which systemd will start for all users when they log in. The administrator can create a specific Quadlet with the container name `podmansh`, then enable users to use the login shell /usr/bin/podmansh. These user login shells are automatically executed inside the `podmansh` container via Podman.
|
||||
|
||||
Optionally, the administrator can place Quadlet files in the /etc/containers/systemd/users/${UID} directory for a user. Only this UID will execute these Quadlet services when that user logs in.
|
||||
|
||||
|
|
|
@ -554,7 +554,7 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
|
|||
session := podmanTest.Podman([]string{"exec", "--wait", "2", "1234"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(125))
|
||||
Expect(session.ErrorToString()).To(Equal("Error: cancelled by user"))
|
||||
Expect(session.ErrorToString()).To(Equal("Error: timed out waiting for container: 1234"))
|
||||
})
|
||||
|
||||
It("podman exec --wait 5 seconds for started container", func() {
|
||||
|
|
|
@ -137,7 +137,7 @@ load helpers
|
|||
|
||||
# wait on bogus container
|
||||
run_podman 125 exec --wait 5 "bogus_container" echo hello
|
||||
assert "$output" = "Error: cancelled by user"
|
||||
assert "$output" = "Error: timed out waiting for container: bogus_container"
|
||||
|
||||
run_podman create --name "wait_container" $IMAGE top
|
||||
run_podman 255 exec --wait 5 "wait_container" echo hello
|
||||
|
|
Loading…
Reference in New Issue