[lxc-devel] [lxd/master] client: Expand snap path in ConnectLXDUnix

stgraber on Github lxc-bot at linuxcontainers.org
Sun Jun 7 02:37:12 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200606/d923fede/attachment.bin>
-------------- next part --------------
From 0c606c071072ff706fd886bb9761198677e803bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 6 Jun 2020 22:36:54 -0400
Subject: [PATCH] client: Expand snap path in ConnectLXDUnix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: St├ęphane Graber <stgraber at ubuntu.com>
---
 client/connection.go | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/client/connection.go b/client/connection.go
index 82af3ccd13..aacfe4d4a1 100644
--- a/client/connection.go
+++ b/client/connection.go
@@ -123,15 +123,6 @@ func ConnectLXDUnix(path string, args *ConnectionArgs) (InstanceServer, error) {
 		args = &ConnectionArgs{}
 	}
 
-	// Initialize the client struct
-	server := ProtocolLXD{
-		httpHost:      "http://unix.socket",
-		httpUnixPath:  path,
-		httpProtocol:  "unix",
-		httpUserAgent: args.UserAgent,
-		chConnected:   make(chan struct{}, 1),
-	}
-
 	// Determine the socket path
 	if path == "" {
 		path = os.Getenv("LXD_SOCKET")
@@ -145,6 +136,17 @@ func ConnectLXDUnix(path string, args *ConnectionArgs) (InstanceServer, error) {
 		}
 	}
 
+	path = shared.HostPath(path)
+
+	// Initialize the client struct
+	server := ProtocolLXD{
+		httpHost:      "http://unix.socket",
+		httpUnixPath:  path,
+		httpProtocol:  "unix",
+		httpUserAgent: args.UserAgent,
+		chConnected:   make(chan struct{}, 1),
+	}
+
 	// Setup the HTTP client
 	httpClient, err := unixHTTPClient(args.HTTPClient, path)
 	if err != nil {


More information about the lxc-devel mailing list