diff options
-rw-r--r-- | cmd/podman/varlink.go | 13 | ||||
-rw-r--r-- | completions/bash/podman | 1 | ||||
-rwxr-xr-x | contrib/python/test/test_runner.sh | 2 | ||||
-rw-r--r-- | docs/podman-varlink.1.md | 33 |
4 files changed, 34 insertions, 15 deletions
diff --git a/cmd/podman/varlink.go b/cmd/podman/varlink.go index a25f776e1..300b5ebe4 100644 --- a/cmd/podman/varlink.go +++ b/cmd/podman/varlink.go @@ -1,6 +1,8 @@ package main import ( + "time" + "github.com/pkg/errors" ioprojectatomicpodman "github.com/projectatomic/libpod/cmd/podman/varlink" "github.com/projectatomic/libpod/pkg/varlinkapi" @@ -15,7 +17,13 @@ var ( run varlink interface ` - varlinkFlags = []cli.Flag{} + varlinkFlags = []cli.Flag{ + cli.IntFlag{ + Name: "timeout, t", + Usage: "time until the varlink session expires in milliseconds. default is 1 second; 0 means no timeout.", + Value: 1000, + }, + } varlinkCommand = cli.Command{ Name: "varlink", Usage: "Run varlink interface", @@ -31,6 +39,7 @@ func varlinkCmd(c *cli.Context) error { if len(args) < 1 { return errors.Errorf("you must provide a varlink URI") } + timeout := time.Duration(c.Int64("timeout")) * time.Millisecond var varlinkInterfaces = []*ioprojectatomicpodman.VarlinkInterface{varlinkapi.New(c)} // Register varlink service. The metadata can be retrieved with: @@ -52,7 +61,7 @@ func varlinkCmd(c *cli.Context) error { } // Run the varlink server at the given address - if err = service.Listen(args[0], 0); err != nil { + if err = service.Listen(args[0], timeout); err != nil { return errors.Errorf("unable to start varlink service") } diff --git a/completions/bash/podman b/completions/bash/podman index c63475133..f7ae8fb85 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -1652,6 +1652,7 @@ _podman_unpause() { _podman_varlink() { local options_with_args=" --help -h + --timeout -t " local boolean_options="" _complete_ "$options_with_args" "$boolean_options" diff --git a/contrib/python/test/test_runner.sh b/contrib/python/test/test_runner.sh index 3e6dee110..ff3a0f781 100755 --- a/contrib/python/test/test_runner.sh +++ b/contrib/python/test/test_runner.sh @@ -98,7 +98,7 @@ $PODMAN --version set -x # Run podman in background without systemd for test purposes -$PODMAN varlink ${PODMAN_HOST} >/tmp/test_runner.output 2>&1 & +$PODMAN --timeout 0 varlink ${PODMAN_HOST} >/tmp/test_runner.output 2>&1 & if [[ -z $1 ]]; then export PYTHONPATH=. diff --git a/docs/podman-varlink.1.md b/docs/podman-varlink.1.md index 9d4e0947b..7ed6c7d92 100644 --- a/docs/podman-varlink.1.md +++ b/docs/podman-varlink.1.md @@ -6,34 +6,43 @@ podman\-varlink - Runs the varlink backend interface ## SYNOPSIS -**podman varlink** +**podman varlink** [OPTIONS] [**--help**|**-h**] VARLINK_URI ## DESCRIPTION -Starts the varlink service that allows varlink clients to interact with podman. -<!-- -More will go here as the docs and api firm up. ---> +Starts the varlink service that allows varlink clients to interact with podman. This should generally be done +with systemd. See _Configuration_ below. -**podman [GLOBAL OPTIONS] varlink ** +**podman [GLOBAL OPTIONS] [OPTIONS] varlink VARLINK_URI** ## GLOBAL OPTIONS **--help, -h** Print usage statement +## OPTIONS +**--timeout, -t** The time until the varlink session expires in _milliseconds_. The default is 1 +second. A value of `0` means no timeout and the session will not expire. + ## EXAMPLES - podman varlink unix:/run/podman/io.projectatomic.podman -<!-- - TODO: More examples with TCP can be added when that works - as well. ---> +Run the podman varlink service manually and accept the default timeout. + +``` +$ podman varlink unix:/run/podman/io.projectatomic.podman +``` + +Run the podman varlink service manually with a 5 second timeout. + +``` +$ podman varlink --timeout 5000 unix:/run/podman/io.projectatomic.podman +``` ## CONFIGURATION -Users of the podman varlink service should enable the io.projectatomic.podman.socket and io.projectatomic.podman.service. +Users of the podman varlink service should enable the _io.projectatomic.podman.socket_ and _io.projectatomic.podman.service_. +This is the preferred method for running the varlink service. You can do this via systemctl |