aboutsummaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/system_varlink.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-05-22 20:14:19 +0200
committerGitHub <noreply@github.com>2020-05-22 20:14:19 +0200
commit4bc819328b898f57fa7c40d7d5f8dc5583ef5eef (patch)
tree7e55e6dbe5037ca446cea38cf398bcf63e8ba4d5 /pkg/domain/infra/abi/system_varlink.go
parentc8d64264c924833440237bf766a05db0cea56a1c (diff)
parente41089244b300af2b3e51ac1e9501b4cfe42264e (diff)
downloadpodman-4bc819328b898f57fa7c40d7d5f8dc5583ef5eef.tar.gz
podman-4bc819328b898f57fa7c40d7d5f8dc5583ef5eef.tar.bz2
podman-4bc819328b898f57fa7c40d7d5f8dc5583ef5eef.zip
Merge pull request #6341 from rhatdan/build6
Attempt to turn on additional build tests
Diffstat (limited to 'pkg/domain/infra/abi/system_varlink.go')
-rw-r--r--pkg/domain/infra/abi/system_varlink.go49
1 files changed, 49 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/system_varlink.go b/pkg/domain/infra/abi/system_varlink.go
new file mode 100644
index 000000000..c0144babe
--- /dev/null
+++ b/pkg/domain/infra/abi/system_varlink.go
@@ -0,0 +1,49 @@
+// +build varlink
+
+package abi
+
+import (
+ "context"
+
+ "github.com/containers/libpod/pkg/domain/entities"
+ iopodman "github.com/containers/libpod/pkg/varlink"
+ iopodmanAPI "github.com/containers/libpod/pkg/varlinkapi"
+ "github.com/containers/libpod/version"
+ "github.com/pkg/errors"
+ "github.com/sirupsen/logrus"
+ "github.com/varlink/go/varlink"
+)
+
+func (ic *ContainerEngine) VarlinkService(_ context.Context, opts entities.ServiceOptions) error {
+ var varlinkInterfaces = []*iopodman.VarlinkInterface{
+ iopodmanAPI.New(opts.Command, ic.Libpod),
+ }
+
+ service, err := varlink.NewService(
+ "Atomic",
+ "podman",
+ version.Version,
+ "https://github.com/containers/libpod",
+ )
+ if err != nil {
+ return errors.Wrapf(err, "unable to create new varlink service")
+ }
+
+ for _, i := range varlinkInterfaces {
+ if err := service.RegisterInterface(i); err != nil {
+ return errors.Errorf("unable to register varlink interface %v", i)
+ }
+ }
+
+ // Run the varlink server at the given address
+ if err = service.Listen(opts.URI, opts.Timeout); err != nil {
+ switch err.(type) {
+ case varlink.ServiceTimeoutError:
+ logrus.Infof("varlink service expired (use --timeout to increase session time beyond %s ms, 0 means never timeout)", opts.Timeout.String())
+ return nil
+ default:
+ return errors.Wrapf(err, "unable to start varlink service")
+ }
+ }
+ return nil
+}