diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-04-19 08:46:37 -0400 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2021-04-20 15:56:45 -0400 |
commit | 659dc7843c560c9386fbc3e54ad860c3f2ef2940 (patch) | |
tree | 90fbd03d2c07aaa11d8a86c5c03338824d982a6d /pkg/util | |
parent | 2a32fc3e403e4b70fb68fda564cbdf33b7dd5326 (diff) | |
download | podman-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 'pkg/util')
-rw-r--r-- | pkg/util/utils.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go index bbaf72981..622fbde99 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -706,3 +706,26 @@ func IDtoolsToRuntimeSpec(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxI } return convertedIDMap } + +var socketPath string + +func SetSocketPath(path string) { + socketPath = path +} + +func SocketPath() (string, error) { + if socketPath != "" { + return socketPath, nil + } + xdg, err := GetRuntimeDir() + if err != nil { + return "", err + } + if len(xdg) == 0 { + // If no xdg is returned, assume root socket + xdg = "/run" + } + + // Glue the socket path together + return filepath.Join(xdg, "podman", "podman.sock"), nil +} |