summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-06-04 14:43:52 +0200
committerGitHub <noreply@github.com>2020-06-04 14:43:52 +0200
commit9d138724ab38842381fbc391734ea50d58161bf5 (patch)
tree3df62afcfc5db21d4e25df3156e1a766159d606e /pkg/domain/infra/abi
parent08ce2c1b2f5d3338959476d0c0c0e6d36f7e3e43 (diff)
parentd023909c0be103f1b02f2ddac0b937fff2d4e4f0 (diff)
downloadpodman-9d138724ab38842381fbc391734ea50d58161bf5.tar.gz
podman-9d138724ab38842381fbc391734ea50d58161bf5.tar.bz2
podman-9d138724ab38842381fbc391734ea50d58161bf5.zip
Merge pull request #6486 from baude/v2infoaddsocket
add socket information to podman info
Diffstat (limited to 'pkg/domain/infra/abi')
-rw-r--r--pkg/domain/infra/abi/system.go33
1 files changed, 32 insertions, 1 deletions
diff --git a/pkg/domain/infra/abi/system.go b/pkg/domain/infra/abi/system.go
index 52dfaba7d..9b538b301 100644
--- a/pkg/domain/infra/abi/system.go
+++ b/pkg/domain/infra/abi/system.go
@@ -25,7 +25,38 @@ import (
)
func (ic *ContainerEngine) Info(ctx context.Context) (*define.Info, error) {
- return ic.Libpod.Info()
+ info, err := ic.Libpod.Info()
+ if err != nil {
+ return nil, err
+ }
+ xdg, err := util.GetRuntimeDir()
+ if err != nil {
+ return nil, err
+ }
+ if len(xdg) == 0 {
+ // If no xdg is returned, assume root socket
+ xdg = "/run"
+ }
+
+ // Glue the socket path together
+ socketPath := filepath.Join(xdg, "podman", "podman.sock")
+ rs := define.RemoteSocket{
+ Path: socketPath,
+ Exists: false,
+ }
+
+ // Check if the socket exists
+ if fi, err := os.Stat(socketPath); err == nil {
+ if fi.Mode()&os.ModeSocket != 0 {
+ rs.Exists = true
+ }
+ }
+ // TODO
+ // it was suggested future versions of this could perform
+ // a ping on the socket for greater confidence the socket is
+ // actually active.
+ info.Host.RemoteSocket = &rs
+ return info, err
}
func (ic *ContainerEngine) SetupRootless(_ context.Context, cmd *cobra.Command) error {