summaryrefslogtreecommitdiff
path: root/pkg/util
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-21 08:05:35 -0400
committerGitHub <noreply@github.com>2021-04-21 08:05:35 -0400
commit544c3156657e078cef297623842f79cb72dc32c6 (patch)
tree21431acac4d8c92fb26276680de283e2d0730982 /pkg/util
parent41677b192aac6ae2849aa792e4ded856773712fd (diff)
parent659dc7843c560c9386fbc3e54ad860c3f2ef2940 (diff)
downloadpodman-544c3156657e078cef297623842f79cb72dc32c6.tar.gz
podman-544c3156657e078cef297623842f79cb72dc32c6.tar.bz2
podman-544c3156657e078cef297623842f79cb72dc32c6.zip
Merge pull request #10080 from rhatdan/remote
podman-remote should show podman.sock info
Diffstat (limited to 'pkg/util')
-rw-r--r--pkg/util/utils.go23
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
+}