summaryrefslogtreecommitdiff
path: root/cmd/podman/system/service_abi.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-04-19 08:46:37 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-04-20 15:56:45 -0400
commit659dc7843c560c9386fbc3e54ad860c3f2ef2940 (patch)
tree90fbd03d2c07aaa11d8a86c5c03338824d982a6d /cmd/podman/system/service_abi.go
parent2a32fc3e403e4b70fb68fda564cbdf33b7dd5326 (diff)
downloadpodman-659dc7843c560c9386fbc3e54ad860c3f2ef2940.tar.gz
podman-659dc7843c560c9386fbc3e54ad860c3f2ef2940.tar.bz2
podman-659dc7843c560c9386fbc3e54ad860c3f2ef2940.zip
podman-remote should show podman.sock info
Currently podman-remote info does not show socket information. Fixes: https://github.com/containers/podman/issues/10077 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd/podman/system/service_abi.go')
-rw-r--r--cmd/podman/system/service_abi.go17
1 files changed, 13 insertions, 4 deletions
diff --git a/cmd/podman/system/service_abi.go b/cmd/podman/system/service_abi.go
index 9e8a9f9b4..364663323 100644
--- a/cmd/podman/system/service_abi.go
+++ b/cmd/podman/system/service_abi.go
@@ -6,11 +6,13 @@ import (
"context"
"net"
"os"
+ "path/filepath"
"strings"
api "github.com/containers/podman/v3/pkg/api/server"
"github.com/containers/podman/v3/pkg/domain/entities"
"github.com/containers/podman/v3/pkg/domain/infra"
+ "github.com/containers/podman/v3/pkg/util"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
@@ -24,6 +26,17 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
)
if opts.URI != "" {
+ fields := strings.Split(opts.URI, ":")
+ if len(fields) == 1 {
+ return errors.Errorf("%s is an invalid socket destination", opts.URI)
+ }
+ path := opts.URI
+ if fields[0] == "unix" {
+ if path, err = filepath.Abs(fields[1]); err != nil {
+ return err
+ }
+ }
+ util.SetSocketPath(path)
if os.Getenv("LISTEN_FDS") != "" {
// If it is activated by systemd, use the first LISTEN_FD (3)
// instead of opening the socket file.
@@ -34,10 +47,6 @@ func restService(opts entities.ServiceOptions, flags *pflag.FlagSet, cfg *entiti
}
listener = &l
} else {
- fields := strings.Split(opts.URI, ":")
- if len(fields) == 1 {
- return errors.Errorf("%s is an invalid socket destination", opts.URI)
- }
network := fields[0]
address := strings.Join(fields[1:], ":")
l, err := net.Listen(network, address)