Skip to content

Commit

Permalink
Merge pull request #11630 from rhatdan/timeout
Browse files Browse the repository at this point in the history
Add support for retrieving system service --timeout
  • Loading branch information
openshift-merge-robot authored Sep 20, 2021
2 parents fff178f + b74edfb commit 7914586
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cmd/podman/system/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ func init() {

flags := srvCmd.Flags()

cfg := registry.PodmanConfig()
timeFlagName := "time"
flags.Int64VarP(&srvArgs.Timeout, timeFlagName, "t", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout")
flags.Int64VarP(&srvArgs.Timeout, timeFlagName, "t", int64(cfg.Engine.ServiceTimeout), "Time until the service session expires in seconds. Use 0 to disable the timeout")
_ = srvCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone)
flags.StringVarP(&srvArgs.CorsHeaders, "cors", "", "", "Set CORS Headers")
_ = srvCmd.RegisterFlagCompletionFunc("cors", completion.AutocompleteNone)
Expand Down
5 changes: 4 additions & 1 deletion docs/source/markdown/podman-system-service.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Note: The default systemd unit files (system and user) change the log-level opti
The time until the session expires in _seconds_. The default is 5
seconds. A value of `0` means no timeout, therefore the session will not expire.

The default timeout can be changed via the `service_timeout=VALUE` field in containers.conf.
See **[containers.conf(5)](https://github.com/containers/common/blob/master/docs/containers.conf.5.md)** for more information.

#### **--cors**

CORS headers to inject to the HTTP response. The default value is empty string which disables CORS headers.
Expand All @@ -46,7 +49,7 @@ podman system service --time 5
```

## SEE ALSO
podman(1), podman-system-service(1), podman-system-connection(1)
**[podman(1)](podman.1.md)**, **[podman-system-connection(1)](podman-system-connection.1.md)**, **[containers.conf(5)](https://github.com/containers/common/blob/master/docs/containers.conf.5.md)**

## HISTORY
January 2020, Originally compiled by Brent Baude `<[email protected]>`
Expand Down
1 change: 1 addition & 0 deletions test/e2e/config/containers.conf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ no_hosts=true
[engine]

network_cmd_options=["allow_host_loopback=true"]
service_timeout=1234

# We need to ensure each test runs on a separate plugin instance...
# For now, let's just make a bunch of plugin paths and have each test use one.
Expand Down
8 changes: 8 additions & 0 deletions test/e2e/containers_conf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,12 @@ var _ = Describe("Podman run", func() {
Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("invalid image_copy_tmp_dir"))
})

It("podman system sevice --help shows (default 20)", func() {
SkipIfRemote("this test is only for local")
result := podmanTest.Podman([]string{"system", "service", "--help"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring("(default 1234)"))
})
})

0 comments on commit 7914586

Please sign in to comment.