[lxc-devel] [lxd/master] client: add default config in NewClientFromInfo

tych0 on Github lxc-bot at linuxcontainers.org
Fri Mar 4 22:48:13 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 499 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160304/9f051e2d/attachment.bin>
-------------- next part --------------
From 230f653afadf4d71bba62ded3415a84bd4c1170b Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Fri, 4 Mar 2016 15:38:49 -0700
Subject: [PATCH] client: add default config in NewClientFromInfo

Now that the API is designed to use these default "ubuntu" remotes, let's
make sure they're available in all instances of the client.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 client.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/client.go b/client.go
index 29e5d75..2c9f525 100644
--- a/client.go
+++ b/client.go
@@ -310,7 +310,11 @@ func connectViaHttp(c *Client, addr, clientCert, clientKey, serverCert string) e
 func NewClientFromInfo(info ConnectInfo) (*Client, error) {
 	c := &Client{
 		// Config: *config,
-		Http: http.Client{},
+		Http:    http.Client{},
+		Config: Config{
+			Remotes: DefaultRemotes,
+			Aliases: map[string]string{},
+		},
 	}
 	c.Name = info.Name
 	var err error


More information about the lxc-devel mailing list