[lxc-devel] [lxd/master] Ditch i18n from client

tych0 on Github lxc-bot at linuxcontainers.org
Thu Feb 4 22:26:27 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160204/6b9efa88/attachment.bin>
-------------- next part --------------
From 58f290f77a33f6772543b37c9a27662abcbf9c6e Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 4 Feb 2016 15:15:08 -0700
Subject: [PATCH 1/2] remove i18n calls from client

This also kills a few Printfs from the client as well.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 client.go     |  99 +++++++++++--------------
 lxc/remote.go |  26 ++++++-
 po/lxd.pot    | 235 ++++++++++++++--------------------------------------------
 3 files changed, 127 insertions(+), 233 deletions(-)

diff --git a/client.go b/client.go
index 0c16722..6664760 100644
--- a/client.go
+++ b/client.go
@@ -23,7 +23,6 @@ import (
 
 	"github.com/gorilla/websocket"
 
-	"github.com/lxc/lxd/i18n"
 	"github.com/lxc/lxd/shared"
 )
 
@@ -110,7 +109,7 @@ func (r *Response) MetadataAsOperation() (*shared.Operation, error) {
 // response (e.g. to inspect the error code).
 func ParseResponse(r *http.Response) (*Response, error) {
 	if r == nil {
-		return nil, fmt.Errorf(i18n.G("no response!"))
+		return nil, fmt.Errorf("no response!")
 	}
 	defer r.Body.Close()
 	ret := Response{}
@@ -146,7 +145,7 @@ func HoistResponse(r *http.Response, rtype ResponseType) (*Response, error) {
 	}
 
 	if resp.Type != rtype {
-		return nil, fmt.Errorf(i18n.G("got bad response type, expected %s got %s"), rtype, resp.Type)
+		return nil, fmt.Errorf("got bad response type, expected %s got %s", rtype, resp.Type)
 	}
 
 	return resp, nil
@@ -184,7 +183,7 @@ func NewClient(config *Config, remote string) (*Client, error) {
 	c.Name = remote
 
 	if remote == "" {
-		return nil, fmt.Errorf(i18n.G("A remote name must be provided."))
+		return nil, fmt.Errorf("A remote name must be provided.")
 	}
 
 	if r, ok := config.Remotes[remote]; ok {
@@ -250,7 +249,7 @@ func NewClient(config *Config, remote string) (*Client, error) {
 			c.Remote = &r
 		}
 	} else {
-		return nil, fmt.Errorf(i18n.G("unknown remote name: %q"), remote)
+		return nil, fmt.Errorf("unknown remote name: %q", remote)
 	}
 
 	return &c, nil
@@ -268,11 +267,11 @@ func (c *Client) Addresses() ([]string, error) {
 	} else if c.Transport == "https" {
 		addresses = append(addresses, c.BaseURL[8:])
 	} else {
-		return nil, fmt.Errorf(i18n.G("unknown transport type: %s"), c.Transport)
+		return nil, fmt.Errorf("unknown transport type: %s", c.Transport)
 	}
 
 	if len(addresses) == 0 {
-		return nil, fmt.Errorf(i18n.G("The source remote isn't available over the network"))
+		return nil, fmt.Errorf("The source remote isn't available over the network")
 	}
 
 	return addresses, nil
@@ -300,7 +299,7 @@ func (c *Client) baseGet(getUrl string) (*Response, error) {
 	if c.scert != nil && resp.TLS != nil {
 		if !bytes.Equal(resp.TLS.PeerCertificates[0].Raw, c.scert.Raw) {
 			pUrl, _ := url.Parse(getUrl)
-			return nil, fmt.Errorf(i18n.G("Server certificate for host %s has changed. Add correct certificate or remove certificate in %s"), pUrl.Host, c.Config.ConfigPath("servercerts"))
+			return nil, fmt.Errorf("Server certificate for host %s has changed. Add correct certificate or remove certificate in %s", pUrl.Host, c.Config.ConfigPath("servercerts"))
 		}
 	}
 
@@ -387,7 +386,7 @@ func (c *Client) getRaw(uri string) (*http.Response, error) {
 		if err != nil {
 			return nil, err
 		}
-		return nil, fmt.Errorf(i18n.G("expected error, got %s"), resp)
+		return nil, fmt.Errorf("expected error, got %s", resp)
 	}
 
 	return raw, nil
@@ -451,7 +450,7 @@ func (c *Client) Finger() error {
 	}
 
 	if serverAPICompat != shared.APICompat {
-		return fmt.Errorf(i18n.G("api version mismatch: mine: %q, daemon: %q"), shared.APICompat, serverAPICompat)
+		return fmt.Errorf("api version mismatch: mine: %q, daemon: %q", shared.APICompat, serverAPICompat)
 	}
 	shared.Debugf("Pong received")
 	return nil
@@ -630,7 +629,7 @@ func (c *Client) CopyImage(image string, dest *Client, copy_aliases bool, aliase
 			dest.DeleteAlias(alias.Name)
 			err = dest.PostAlias(alias.Name, alias.Description, info.Fingerprint)
 			if err != nil {
-				fmt.Printf(i18n.G("Error adding alias %s")+"\n", alias.Name)
+				return fmt.Errorf("Error adding alias %s: %s", alias.Name, err)
 			}
 		}
 	}
@@ -640,7 +639,7 @@ func (c *Client) CopyImage(image string, dest *Client, copy_aliases bool, aliase
 		dest.DeleteAlias(alias)
 		err = dest.PostAlias(alias, alias, info.Fingerprint)
 		if err != nil {
-			fmt.Printf(i18n.G("Error adding alias %s")+"\n", alias)
+			return fmt.Errorf("Error adding alias %s: %s\n", alias, err)
 		}
 	}
 
@@ -662,7 +661,7 @@ func (c *Client) ExportImage(image string, target string) (*Response, string, er
 	// Deal with split images
 	if ctype == "multipart/form-data" {
 		if !shared.IsDir(target) {
-			return nil, "", fmt.Errorf(i18n.G("Split images can only be written to a directory."))
+			return nil, "", fmt.Errorf("Split images can only be written to a directory.")
 		}
 
 		// Parse the POST data
@@ -795,7 +794,7 @@ func (c *Client) PostImageURL(imageFile string, public bool, aliases []string) (
 	}
 
 	if op.Metadata == nil {
-		return "", fmt.Errorf(i18n.G("Missing operation metadata"))
+		return "", fmt.Errorf("Missing operation metadata")
 	}
 
 	fingerprint, err := op.Metadata.GetString("fingerprint")
@@ -808,7 +807,7 @@ func (c *Client) PostImageURL(imageFile string, public bool, aliases []string) (
 		c.DeleteAlias(alias)
 		err = c.PostAlias(alias, alias, fingerprint)
 		if err != nil {
-			fmt.Printf(i18n.G("Error adding alias %s")+"\n", alias)
+			return "", fmt.Errorf("Error adding alias %s: %s", alias, err)
 		}
 	}
 
@@ -902,7 +901,7 @@ func (c *Client) PostImage(imageFile string, rootfsFile string, properties []str
 			if eqIndex > -1 {
 				imgProps.Set(value[:eqIndex], value[eqIndex+1:])
 			} else {
-				return "", fmt.Errorf(i18n.G("Bad image property: %s"), value)
+				return "", fmt.Errorf("Bad image property: %s", value)
 			}
 
 		}
@@ -935,7 +934,7 @@ func (c *Client) PostImage(imageFile string, rootfsFile string, properties []str
 		c.DeleteAlias(alias)
 		err = c.PostAlias(alias, alias, fingerprint)
 		if err != nil {
-			fmt.Printf(i18n.G("Error adding alias %s")+"\n", alias)
+			return "", fmt.Errorf("Error adding alias %s: %s", alias, err)
 		}
 	}
 
@@ -1011,48 +1010,40 @@ func (c *Client) ListAliases() ([]shared.ImageAlias, error) {
 	return result, nil
 }
 
-func (c *Client) UserAuthServerCert(name string, acceptCert bool) error {
+// Try to verify the server's cert with the current host's CA list.
+func (c *Client) TryVerifyServerCert(name string) (string, error) {
+	digest := fmt.Sprintf("%x", c.scertDigest)
 	if !c.scertDigestSet {
 		if err := c.Finger(); err != nil {
-			return err
+			return digest, err
 		}
 
 		if !c.scertDigestSet {
-			return fmt.Errorf(i18n.G("No certificate on this connection"))
+			return digest, fmt.Errorf("No certificate on this connection")
 		}
 	}
 
 	if c.scert != nil {
-		return nil
+		return digest, nil
 	}
 
 	_, err := c.scertWire.Verify(x509.VerifyOptions{
 		DNSName:       name,
 		Intermediates: c.scertIntermediates,
 	})
-	if err == nil {
-		// Server trusted by system certificate
-		return nil
-	}
-
-	if acceptCert == false {
-		fmt.Printf(i18n.G("Certificate fingerprint: %x")+"\n", c.scertDigest)
-		fmt.Printf(i18n.G("ok (y/n)?") + " ")
-		line, err := shared.ReadStdin()
-		if err != nil {
-			return err
-		}
+	return digest, err
+}
 
-		if len(line) < 1 || line[0] != 'y' && line[0] != 'Y' {
-			return fmt.Errorf(i18n.G("Server certificate NACKed by user"))
-		}
+func (c *Client) SaveCert(name string) error {
+	if c.scertWire == nil {
+		return fmt.Errorf("can't save empty server cert")
 	}
 
 	// User acked the cert, now add it to our store
 	dnam := c.Config.ConfigPath("servercerts")
-	err = os.MkdirAll(dnam, 0750)
+	err := os.MkdirAll(dnam, 0750)
 	if err != nil {
-		return fmt.Errorf(i18n.G("Could not create server cert dir"))
+		return fmt.Errorf("Could not create server cert dir")
 	}
 	certf := fmt.Sprintf("%s/%s.crt", dnam, c.Name)
 	certOut, err := os.Create(certf)
@@ -1142,7 +1133,7 @@ func (c *Client) Init(name string, imgremote string, image string, profiles *[]s
 	source := shared.Jmap{"type": "image"}
 
 	if image == "" {
-		return nil, fmt.Errorf(i18n.G("You must provide an image hash or alias name."))
+		return nil, fmt.Errorf("You must provide an image hash or alias name.")
 	}
 
 	if imgremote != c.Name {
@@ -1164,7 +1155,7 @@ func (c *Client) Init(name string, imgremote string, image string, profiles *[]s
 		}
 
 		if len(architectures) != 0 && !shared.IntInSlice(imageinfo.Architecture, architectures) {
-			return nil, fmt.Errorf(i18n.G("The image architecture is incompatible with the target server"))
+			return nil, fmt.Errorf("The image architecture is incompatible with the target server")
 		}
 
 		// FIXME: InterfaceToBool is there for backward compatibility
@@ -1205,11 +1196,11 @@ func (c *Client) Init(name string, imgremote string, image string, profiles *[]s
 
 		imageinfo, err := c.GetImageInfo(fingerprint)
 		if err != nil {
-			return nil, fmt.Errorf(i18n.G("can't get info for image '%s': %s"), image, err)
+			return nil, fmt.Errorf("can't get info for image '%s': %s", image, err)
 		}
 
 		if len(architectures) != 0 && !shared.IntInSlice(imageinfo.Architecture, architectures) {
-			return nil, fmt.Errorf(i18n.G("The image architecture is incompatible with the target server"))
+			return nil, fmt.Errorf("The image architecture is incompatible with the target server")
 		}
 		source["fingerprint"] = fingerprint
 	}
@@ -1434,11 +1425,11 @@ func (c *Client) Exec(name string, cmd []string, env map[string]string,
 	}
 
 	if op.StatusCode != shared.Success {
-		return -1, fmt.Errorf(i18n.G("got bad op status %s"), op.Status)
+		return -1, fmt.Errorf("got bad op status %s", op.Status)
 	}
 
 	if op.Metadata == nil {
-		return -1, fmt.Errorf(i18n.G("no metadata received"))
+		return -1, fmt.Errorf("no metadata received")
 	}
 
 	return op.Metadata.GetInt("return")
@@ -1616,7 +1607,7 @@ func (c *Client) Rename(name string, newName string) (*Response, error) {
 /* Wait for an operation */
 func (c *Client) WaitFor(waitURL string) (*shared.Operation, error) {
 	if len(waitURL) < 1 {
-		return nil, fmt.Errorf(i18n.G("invalid wait url %s"), waitURL)
+		return nil, fmt.Errorf("invalid wait url %s", waitURL)
 	}
 
 	/* For convenience, waitURL is expected to be in the form of a
@@ -1832,7 +1823,7 @@ func (c *Client) SetProfileConfigItem(profile, key, value string) error {
 
 func (c *Client) PutProfile(name string, profile shared.ProfileConfig) error {
 	if profile.Name != name {
-		return fmt.Errorf(i18n.G("Cannot change profile name"))
+		return fmt.Errorf("Cannot change profile name")
 	}
 	body := shared.Jmap{"name": name, "config": profile.Config, "devices": profile.Devices}
 	_, err := c.put(fmt.Sprintf("profiles/%s", name), body, Sync)
@@ -1863,11 +1854,11 @@ func (c *Client) ListProfiles() ([]string, error) {
 		}
 
 		if count != 2 {
-			return nil, fmt.Errorf(i18n.G("bad profile url %s"), url)
+			return nil, fmt.Errorf("bad profile url %s", url)
 		}
 
 		if version != shared.APIVersion {
-			return nil, fmt.Errorf(i18n.G("bad version in profile url"))
+			return nil, fmt.Errorf("bad version in profile url")
 		}
 
 		names = append(names, name)
@@ -1909,14 +1900,14 @@ func (c *Client) ContainerDeviceAdd(container, devname, devtype string, props []
 	for _, p := range props {
 		results := strings.SplitN(p, "=", 2)
 		if len(results) != 2 {
-			return nil, fmt.Errorf(i18n.G("no value found in %q"), p)
+			return nil, fmt.Errorf("no value found in %q", p)
 		}
 		k := results[0]
 		v := results[1]
 		newdev[k] = v
 	}
 	if st.Devices != nil && st.Devices.ContainsName(devname) {
-		return nil, fmt.Errorf(i18n.G("device already exists"))
+		return nil, fmt.Errorf("device already exists")
 	}
 	newdev["type"] = devtype
 	if st.Devices == nil {
@@ -1966,14 +1957,14 @@ func (c *Client) ProfileDeviceAdd(profile, devname, devtype string, props []stri
 	for _, p := range props {
 		results := strings.SplitN(p, "=", 2)
 		if len(results) != 2 {
-			return nil, fmt.Errorf(i18n.G("no value found in %q"), p)
+			return nil, fmt.Errorf("no value found in %q", p)
 		}
 		k := results[0]
 		v := results[1]
 		newdev[k] = v
 	}
 	if st.Devices != nil && st.Devices.ContainsName(devname) {
-		return nil, fmt.Errorf(i18n.G("device already exists"))
+		return nil, fmt.Errorf("device already exists")
 	}
 	newdev["type"] = devtype
 	if st.Devices == nil {
@@ -2037,7 +2028,7 @@ func (c *Client) AsyncWaitMeta(resp *Response) (*shared.Jmap, error) {
 	}
 
 	if op.StatusCode != shared.Success {
-		return nil, fmt.Errorf(i18n.G("got bad op status %s"), op.Status)
+		return nil, fmt.Errorf("got bad op status %s", op.Status)
 	}
 
 	return op.Metadata, nil
@@ -2070,7 +2061,7 @@ func (c *Client) ImageFromContainer(cname string, public bool, aliases []string,
 		c.DeleteAlias(alias)
 		err = c.PostAlias(alias, alias, fingerprint)
 		if err != nil {
-			fmt.Printf(i18n.G("Error adding alias %s")+"\n", alias)
+			return "", fmt.Errorf("Error adding alias %s: %s", alias, err)
 		}
 	}
 
diff --git a/lxc/remote.go b/lxc/remote.go
index 68b36e9..27f44b5 100644
--- a/lxc/remote.go
+++ b/lxc/remote.go
@@ -133,7 +133,31 @@ func addServer(config *lxd.Config, server string, addr string, acceptCert bool,
 		return nil
 	}
 
-	err = c.UserAuthServerCert(host, acceptCert)
+	/* grab the server's cert */
+	err = c.Finger()
+	if err != nil {
+		return err
+	}
+
+	if !acceptCert {
+		// Try to use the CAs on localhost to verify the cert so we
+		// don't have to bother the user.
+		digest, err := c.TryVerifyServerCert(host)
+		if err != nil {
+			fmt.Printf(i18n.G("Certificate fingerprint: %x")+"\n", digest)
+			fmt.Printf(i18n.G("ok (y/n)?") + " ")
+			line, err := shared.ReadStdin()
+			if err != nil {
+				return err
+			}
+
+			if len(line) < 1 || line[0] != 'y' && line[0] != 'Y' {
+				return fmt.Errorf("Server certificate NACKed by user")
+			}
+		}
+	}
+
+	err = c.SaveCert(host)
 	if err != nil {
 		return err
 	}
diff --git a/po/lxd.pot b/po/lxd.pot
index 3216f97..1ef87b1 100644
--- a/po/lxd.pot
+++ b/po/lxd.pot
@@ -7,7 +7,7 @@
 msgid   ""
 msgstr  "Project-Id-Version: lxd\n"
         "Report-Msgid-Bugs-To: lxc-devel at lists.linuxcontainers.org\n"
-        "POT-Creation-Date: 2016-01-29 02:55+0530\n"
+        "POT-Creation-Date: 2016-02-04 15:13-0700\n"
         "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
         "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
         "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -36,7 +36,7 @@ msgid   "### This is a yaml representation of the configuration.\n"
         "### Note that the name is shown but cannot be changed"
 msgstr  ""
 
-#: lxc/image.go:28
+#: lxc/image.go:29
 msgid   "### This is a yaml representation of the image properties.\n"
         "### Any line starting with a '# will be ignored.\n"
         "###\n"
@@ -65,7 +65,7 @@ msgid   "### This is a yaml representation of the profile.\n"
         "### Note that the name is shown but cannot be changed"
 msgstr  ""
 
-#: lxc/image.go:500
+#: lxc/image.go:501
 #, c-format
 msgid   "%s (%d more)"
 msgstr  ""
@@ -78,15 +78,11 @@ msgstr  ""
 msgid   "(none)"
 msgstr  ""
 
-#: client.go:187
-msgid   "A remote name must be provided."
-msgstr  ""
-
-#: lxc/image.go:521 lxc/image.go:543
+#: lxc/image.go:522 lxc/image.go:544
 msgid   "ALIAS"
 msgstr  ""
 
-#: lxc/image.go:525
+#: lxc/image.go:526
 msgid   "ARCH"
 msgstr  ""
 
@@ -94,12 +90,12 @@ msgstr  ""
 msgid   "Accept certificate"
 msgstr  ""
 
-#: lxc/remote.go:157
+#: lxc/remote.go:177
 #, c-format
 msgid   "Admin password for %s: "
 msgstr  ""
 
-#: lxc/image.go:281
+#: lxc/image.go:282
 msgid   "Aliases:"
 msgstr  ""
 
@@ -107,7 +103,7 @@ msgstr  ""
 msgid   "An environment variable of the form HOME=/home/foo"
 msgstr  ""
 
-#: lxc/image.go:264
+#: lxc/image.go:265
 #, c-format
 msgid   "Architecture: %s"
 msgstr  ""
@@ -116,24 +112,15 @@ msgstr  ""
 msgid   "Available commands:"
 msgstr  ""
 
-#: client.go:905
-#, c-format
-msgid   "Bad image property: %s"
-msgstr  ""
-
 #: lxc/config.go:232
 msgid   "COMMON NAME"
 msgstr  ""
 
-#: client.go:1835
-msgid   "Cannot change profile name"
-msgstr  ""
-
 #: lxc/profile.go:325
 msgid   "Cannot provide container name to list"
 msgstr  ""
 
-#: client.go:1039
+#: lxc/remote.go:143
 #, c-format
 msgid   "Certificate fingerprint: %x"
 msgstr  ""
@@ -145,11 +132,11 @@ msgid   "Changes state of one or more containers to %s.\n"
         "lxc %s <name> [<name>...]"
 msgstr  ""
 
-#: lxc/remote.go:180
+#: lxc/remote.go:200
 msgid   "Client certificate stored at server: "
 msgstr  ""
 
-#: lxc/list.go:79
+#: lxc/list.go:80
 msgid   "Columns"
 msgstr  ""
 
@@ -157,7 +144,7 @@ msgstr  ""
 msgid   "Config key/value to apply to the new container"
 msgstr  ""
 
-#: lxc/config.go:458 lxc/config.go:523 lxc/image.go:598 lxc/profile.go:185
+#: lxc/config.go:458 lxc/config.go:523 lxc/image.go:599 lxc/profile.go:185
 #, c-format
 msgid   "Config parsing error: %s"
 msgstr  ""
@@ -180,7 +167,7 @@ msgstr  ""
 msgid   "Container published with fingerprint: %s"
 msgstr  ""
 
-#: lxc/image.go:115
+#: lxc/image.go:116
 msgid   "Copy aliases from source"
 msgstr  ""
 
@@ -190,15 +177,11 @@ msgid   "Copy containers within or in between lxd instances.\n"
         "lxc copy [remote:]<source container> [remote:]<destination container> [--ephemeral|e]"
 msgstr  ""
 
-#: lxc/image.go:210
+#: lxc/image.go:211
 #, c-format
 msgid   "Copying the image: %s"
 msgstr  ""
 
-#: client.go:1055
-msgid   "Could not create server cert dir"
-msgstr  ""
-
 #: lxc/snapshot.go:21
 msgid   "Create a read-only snapshot of a container.\n"
         "\n"
@@ -215,7 +198,7 @@ msgid   "Create a read-only snapshot of a container.\n"
         "lxc snapshot u1 snap0"
 msgstr  ""
 
-#: lxc/image.go:269
+#: lxc/image.go:270
 #, c-format
 msgid   "Created: %s"
 msgstr  ""
@@ -229,7 +212,7 @@ msgstr  ""
 msgid   "Creating the container"
 msgstr  ""
 
-#: lxc/image.go:524
+#: lxc/image.go:525
 msgid   "DESCRIPTION"
 msgstr  ""
 
@@ -251,7 +234,7 @@ msgstr  ""
 msgid   "Device %s removed from %s"
 msgstr  ""
 
-#: lxc/list.go:226
+#: lxc/list.go:239
 msgid   "EPHEMERAL"
 msgstr  ""
 
@@ -275,11 +258,6 @@ msgstr  ""
 msgid   "Ephemeral container"
 msgstr  ""
 
-#: client.go:633 client.go:643 client.go:811 client.go:938 client.go:2073
-#, c-format
-msgid   "Error adding alias %s"
-msgstr  ""
-
 #: lxc/monitor.go:56
 msgid   "Event type to listen for"
 msgstr  ""
@@ -290,20 +268,20 @@ msgid   "Execute the specified command in a container.\n"
         "lxc exec [remote:]container [--mode=auto|interactive|non-interactive] [--env EDITOR=/usr/bin/vim]... <command>"
 msgstr  ""
 
-#: lxc/image.go:273
+#: lxc/image.go:274
 #, c-format
 msgid   "Expires: %s"
 msgstr  ""
 
-#: lxc/image.go:275
+#: lxc/image.go:276
 msgid   "Expires: never"
 msgstr  ""
 
-#: lxc/config.go:231 lxc/image.go:522 lxc/image.go:544
+#: lxc/config.go:231 lxc/image.go:523 lxc/image.go:545
 msgid   "FINGERPRINT"
 msgstr  ""
 
-#: lxc/image.go:254
+#: lxc/image.go:255
 #, c-format
 msgid   "Fingerprint: %s"
 msgstr  ""
@@ -330,11 +308,11 @@ msgstr  ""
 msgid   "Generating a client certificate. This may take a minute..."
 msgstr  ""
 
-#: lxc/list.go:224
+#: lxc/list.go:237
 msgid   "IPV4"
 msgstr  ""
 
-#: lxc/list.go:225
+#: lxc/list.go:238
 msgid   "IPV6"
 msgstr  ""
 
@@ -346,11 +324,11 @@ msgstr  ""
 msgid   "If this is your first run, you will need to import images using the 'lxd-images' script."
 msgstr  ""
 
-#: lxc/image.go:215
+#: lxc/image.go:216
 msgid   "Image copied successfully!"
 msgstr  ""
 
-#: lxc/image.go:339
+#: lxc/image.go:340
 #, c-format
 msgid   "Image imported with fingerprint: %s"
 msgstr  ""
@@ -418,7 +396,7 @@ msgid   "List information on containers.\n"
         "lxc info [<remote>:]container [--show-log]"
 msgstr  ""
 
-#: lxc/list.go:53
+#: lxc/list.go:54
 msgid   "Lists the available resources.\n"
         "\n"
         "lxc list [resource] [filters] -c [columns]\n"
@@ -445,7 +423,7 @@ msgstr  ""
 msgid   "Log:"
 msgstr  ""
 
-#: lxc/image.go:114
+#: lxc/image.go:115
 msgid   "Make image public"
 msgstr  ""
 
@@ -544,7 +522,7 @@ msgid   "Manage remote LXD servers.\n"
         "lxc remote get-default                                                                 Print the default remote."
 msgstr  ""
 
-#: lxc/image.go:37
+#: lxc/image.go:38
 msgid   "Manipulate container images.\n"
         "\n"
         "In LXD containers are created from images. Those images were themselves\n"
@@ -600,10 +578,6 @@ msgid   "Manipulate container images.\n"
         "    List the aliases.\n"
 msgstr  ""
 
-#: client.go:798
-msgid   "Missing operation metadata"
-msgstr  ""
-
 #: lxc/help.go:86
 msgid   "Missing summary."
 msgstr  ""
@@ -636,11 +610,11 @@ msgid   "Move containers within or in between lxd instances.\n"
         "    Rename a local container.\n"
 msgstr  ""
 
-#: lxc/list.go:222 lxc/remote.go:247
+#: lxc/list.go:235 lxc/remote.go:267
 msgid   "NAME"
 msgstr  ""
 
-#: lxc/list.go:291 lxc/remote.go:233
+#: lxc/list.go:304 lxc/remote.go:253
 msgid   "NO"
 msgstr  ""
 
@@ -649,14 +623,10 @@ msgstr  ""
 msgid   "Name: %s"
 msgstr  ""
 
-#: lxc/image.go:116 lxc/publish.go:30
+#: lxc/image.go:117 lxc/publish.go:30
 msgid   "New alias to define at target"
 msgstr  ""
 
-#: client.go:1021
-msgid   "No certificate on this connection"
-msgstr  ""
-
 #: lxc/config.go:245
 msgid   "No certificate provided to add"
 msgstr  ""
@@ -665,7 +635,7 @@ msgstr  ""
 msgid   "No fingerprint specified."
 msgstr  ""
 
-#: lxc/image.go:331
+#: lxc/image.go:332
 msgid   "Only https:// is supported for remote image import."
 msgstr  ""
 
@@ -673,7 +643,7 @@ msgstr  ""
 msgid   "Options:"
 msgstr  ""
 
-#: lxc/image.go:425
+#: lxc/image.go:426
 #, c-format
 msgid   "Output is in %s"
 msgstr  ""
@@ -682,11 +652,11 @@ msgstr  ""
 msgid   "Override the terminal mode (auto, interactive or non-interactive)"
 msgstr  ""
 
-#: lxc/list.go:228
+#: lxc/list.go:241
 msgid   "PID"
 msgstr  ""
 
-#: lxc/image.go:523 lxc/remote.go:249
+#: lxc/image.go:524 lxc/remote.go:269
 msgid   "PUBLIC"
 msgstr  ""
 
@@ -712,7 +682,7 @@ msgstr  ""
 msgid   "Press enter to open the editor again"
 msgstr  ""
 
-#: lxc/config.go:459 lxc/config.go:524 lxc/image.go:599
+#: lxc/config.go:459 lxc/config.go:524 lxc/image.go:600
 msgid   "Press enter to start the editor again"
 msgstr  ""
 
@@ -758,7 +728,7 @@ msgstr  ""
 msgid   "Profile to apply to the new container"
 msgstr  ""
 
-#: lxc/image.go:277
+#: lxc/image.go:278
 msgid   "Properties:"
 msgstr  ""
 
@@ -766,7 +736,7 @@ msgstr  ""
 msgid   "Public image server"
 msgstr  ""
 
-#: lxc/image.go:265
+#: lxc/image.go:266
 #, c-format
 msgid   "Public: %s"
 msgstr  ""
@@ -786,28 +756,19 @@ msgstr  ""
 msgid   "Retrieving image: %s"
 msgstr  ""
 
-#: lxc/image.go:526
+#: lxc/image.go:527
 msgid   "SIZE"
 msgstr  ""
 
-#: lxc/list.go:227
+#: lxc/list.go:240
 msgid   "SNAPSHOTS"
 msgstr  ""
 
-#: lxc/list.go:223
+#: lxc/list.go:236
 msgid   "STATE"
 msgstr  ""
 
-#: client.go:1047
-msgid   "Server certificate NACKed by user"
-msgstr  ""
-
-#: client.go:303
-#, c-format
-msgid   "Server certificate for host %s has changed. Add correct certificate or remove certificate in %s"
-msgstr  ""
-
-#: lxc/remote.go:177
+#: lxc/remote.go:197
 msgid   "Server doesn't trust us after adding our cert"
 msgstr  ""
 
@@ -844,19 +805,15 @@ msgstr  ""
 msgid   "Show the container's last 100 log lines?"
 msgstr  ""
 
-#: lxc/image.go:262
+#: lxc/image.go:263
 #, c-format
 msgid   "Size: %.2fMB"
 msgstr  ""
 
-#: lxc/info.go:112 lxc/list.go:170
+#: lxc/info.go:112 lxc/list.go:183
 msgid   "Snapshots:"
 msgstr  ""
 
-#: client.go:665
-msgid   "Split images can only be written to a directory."
-msgstr  ""
-
 #: lxc/launch.go:118
 #, c-format
 msgid   "Starting %s"
@@ -871,14 +828,6 @@ msgstr  ""
 msgid   "Stopping container failed!"
 msgstr  ""
 
-#: client.go:1167 client.go:1212
-msgid   "The image architecture is incompatible with the target server"
-msgstr  ""
-
-#: client.go:275
-msgid   "The source remote isn't available over the network"
-msgstr  ""
-
 #: lxc/publish.go:57
 msgid   "There is no \"image name\".  Did you want an alias?"
 msgstr  ""
@@ -887,7 +836,7 @@ msgstr  ""
 msgid   "Time to wait for the container before killing it."
 msgstr  ""
 
-#: lxc/image.go:266
+#: lxc/image.go:267
 msgid   "Timestamps:"
 msgstr  ""
 
@@ -904,15 +853,15 @@ msgstr  ""
 msgid   "Type: persistent"
 msgstr  ""
 
-#: lxc/image.go:527
+#: lxc/image.go:528
 msgid   "UPLOAD DATE"
 msgstr  ""
 
-#: lxc/remote.go:248
+#: lxc/remote.go:268
 msgid   "URL"
 msgstr  ""
 
-#: lxc/image.go:271
+#: lxc/image.go:272
 #, c-format
 msgid   "Uploaded: %s"
 msgstr  ""
@@ -938,61 +887,34 @@ msgstr  ""
 msgid   "Whether to show the expanded configuration"
 msgstr  ""
 
-#: lxc/list.go:289 lxc/remote.go:235
+#: lxc/list.go:302 lxc/remote.go:255
 msgid   "YES"
 msgstr  ""
 
-#: client.go:1145
-msgid   "You must provide an image hash or alias name."
-msgstr  ""
-
 #: lxc/main.go:65
 msgid   "`lxc config profile` is deprecated, please use `lxc profile`"
 msgstr  ""
 
-#: client.go:454
-#, c-format
-msgid   "api version mismatch: mine: %q, daemon: %q"
-msgstr  ""
-
 #: lxc/launch.go:105
 msgid   "bad number of things scanned from image, container or snapshot"
 msgstr  ""
 
-#: client.go:1866
-#, c-format
-msgid   "bad profile url %s"
-msgstr  ""
-
 #: lxc/action.go:58
 msgid   "bad result type from action"
 msgstr  ""
 
-#: client.go:1870
-msgid   "bad version in profile url"
-msgstr  ""
-
 #: lxc/copy.go:79
 msgid   "can't copy to the same container name"
 msgstr  ""
 
-#: client.go:1208
-#, c-format
-msgid   "can't get info for image '%s': %s"
-msgstr  ""
-
-#: lxc/remote.go:223
+#: lxc/remote.go:243
 msgid   "can't remove the default remote"
 msgstr  ""
 
-#: lxc/remote.go:240
+#: lxc/remote.go:260
 msgid   "default"
 msgstr  ""
 
-#: client.go:1919 client.go:1976
-msgid   "device already exists"
-msgstr  ""
-
 #: lxc/init.go:197 lxc/init.go:202 lxc/launch.go:89 lxc/launch.go:94
 msgid   "didn't get any affected image, container or snapshot from server"
 msgstr  ""
@@ -1007,52 +929,19 @@ msgstr  ""
 msgid   "error: unknown command: %s"
 msgstr  ""
 
-#: client.go:390
-#, c-format
-msgid   "expected error, got %s"
-msgstr  ""
-
-#: client.go:1437 client.go:2040
-#, c-format
-msgid   "got bad op status %s"
-msgstr  ""
-
-#: client.go:149
-#, c-format
-msgid   "got bad response type, expected %s got %s"
-msgstr  ""
-
 #: lxc/launch.go:109
 msgid   "got bad version"
 msgstr  ""
 
-#: client.go:1619
-#, c-format
-msgid   "invalid wait url %s"
-msgstr  ""
-
-#: lxc/image.go:255 lxc/image.go:503
+#: lxc/image.go:256 lxc/image.go:504
 msgid   "no"
 msgstr  ""
 
-#: client.go:1441
-msgid   "no metadata received"
-msgstr  ""
-
-#: client.go:113
-msgid   "no response!"
-msgstr  ""
-
-#: client.go:1912 client.go:1969
-#, c-format
-msgid   "no value found in %q"
-msgstr  ""
-
 #: lxc/copy.go:101
 msgid   "not all the profiles from the source exist on the target"
 msgstr  ""
 
-#: client.go:1040
+#: lxc/remote.go:144
 msgid   "ok (y/n)?"
 msgstr  ""
 
@@ -1061,31 +950,21 @@ msgstr  ""
 msgid   "processing aliases failed %s\n"
 msgstr  ""
 
-#: lxc/remote.go:267
+#: lxc/remote.go:287
 #, c-format
 msgid   "remote %s already exists"
 msgstr  ""
 
-#: lxc/remote.go:219 lxc/remote.go:263 lxc/remote.go:293 lxc/remote.go:304
+#: lxc/remote.go:239 lxc/remote.go:283 lxc/remote.go:313 lxc/remote.go:324
 #, c-format
 msgid   "remote %s doesn't exist"
 msgstr  ""
 
-#: lxc/remote.go:203
+#: lxc/remote.go:223
 #, c-format
 msgid   "remote %s exists as <%s>"
 msgstr  ""
 
-#: client.go:253
-#, c-format
-msgid   "unknown remote name: %q"
-msgstr  ""
-
-#: client.go:271
-#, c-format
-msgid   "unknown transport type: %s"
-msgstr  ""
-
 #: lxc/exec.go:158
 msgid   "unreachable return reached"
 msgstr  ""
@@ -1094,7 +973,7 @@ msgstr  ""
 msgid   "wrong number of subcommand arguments"
 msgstr  ""
 
-#: lxc/image.go:259 lxc/image.go:508
+#: lxc/image.go:260 lxc/image.go:509
 msgid   "yes"
 msgstr  ""
 

From 4f6f3fa6896f21c20d87a22de60d9b31658aaa85 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 4 Feb 2016 15:17:34 -0700
Subject: [PATCH 2/2] fix go vet error

This isn't related to this patch, but I'd say it's a new thing that go vet
starts warning about that the jenkins go vet doesn't know of.

client.go:389: arg *resp for printf verb %s of wrong type: lxd.Response

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

diff --git a/client.go b/client.go
index 6664760..6bb9550 100644
--- a/client.go
+++ b/client.go
@@ -386,7 +386,7 @@ func (c *Client) getRaw(uri string) (*http.Response, error) {
 		if err != nil {
 			return nil, err
 		}
-		return nil, fmt.Errorf("expected error, got %s", resp)
+		return nil, fmt.Errorf("expected error, got %v", *resp)
 	}
 
 	return raw, nil


More information about the lxc-devel mailing list