[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Thu Mar 2 02:17:58 UTC 2017


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/20170302/084e1438/attachment.bin>
-------------- next part --------------
From b7cff1de7fa2000ff243b94dc0f4d7ab224599de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 28 Feb 2017 23:56:46 -0500
Subject: [PATCH 1/3] "lxd init" can be run by trusted users now
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>
---
 README.md   | 2 +-
 lxc/main.go | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 5fdc5eb..71cc926 100644
--- a/README.md
+++ b/README.md
@@ -233,7 +233,7 @@ choice installed on the machine (btrfs-progs, lvm2 or zfsutils-linux).
 By default, LXD comes with no configured network or storage.
 You can get a basic configuration done with:
 
-    sudo lxd init
+    lxd init
 
 "lxd init" supports both directory based storage and ZFS.
 If you want something else, you'll need to use the "lxc storage" command:
diff --git a/lxc/main.go b/lxc/main.go
index 70e7d10..748f286 100644
--- a/lxc/main.go
+++ b/lxc/main.go
@@ -133,7 +133,7 @@ func run() error {
 			return err
 		}
 
-		fmt.Fprintf(os.Stderr, i18n.G("If this is your first time using LXD, you should also run: sudo lxd init")+"\n")
+		fmt.Fprintf(os.Stderr, i18n.G("If this is your first time using LXD, you should also run: lxd init")+"\n")
 		fmt.Fprintf(os.Stderr, i18n.G("To start your first container, try: lxc launch ubuntu:16.04")+"\n\n")
 	}
 

From 838f54b63536624ab4de83535da6df9c32a0d124 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 28 Feb 2017 23:57:06 -0500
Subject: [PATCH 2/3] Update i18n
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>
---
 po/de.po   | 5 ++---
 po/el.po   | 5 ++---
 po/fr.po   | 6 +++---
 po/ja.po   | 6 +++---
 po/lxd.pot | 4 ++--
 po/nl.po   | 5 ++---
 po/ru.po   | 5 ++---
 7 files changed, 16 insertions(+), 20 deletions(-)

diff --git a/po/de.po b/po/de.po
index d3b919a..2332d6c 100644
--- a/po/de.po
+++ b/po/de.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: 2017-02-14 17:11+0000\n"
 "Last-Translator: Tim Rose <tim at netlope.de>\n"
 "Language-Team: German <https://hosted.weblate.org/projects/linux-containers/"
@@ -594,8 +594,7 @@ msgid "ISSUE DATE"
 msgstr ""
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr ""
 
 #: lxc/main.go:43
diff --git a/po/el.po b/po/el.po
index 6fe202e..78e5678 100644
--- a/po/el.po
+++ b/po/el.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: 2017-02-14 08:00+0000\n"
 "Last-Translator: Simos Xenitellis <simos.65 at gmail.com>\n"
 "Language-Team: Greek <https://hosted.weblate.org/projects/linux-containers/"
@@ -476,8 +476,7 @@ msgid "ISSUE DATE"
 msgstr ""
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr ""
 
 #: lxc/main.go:43
diff --git a/po/fr.po b/po/fr.po
index b6c3232..cf622ba 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: 2017-02-24 23:43+0000\n"
 "Last-Translator: Christophe CHAUVET <christophe.chauvet at gmail.com>\n"
 "Language-Team: French <https://hosted.weblate.org/projects/linux-containers/"
@@ -600,8 +600,8 @@ msgid "ISSUE DATE"
 msgstr "DATE D'ÉMISSION"
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+#, fuzzy
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr ""
 "Si c'est la première fois que vous lancez LXD, vous devriez aussi lancer : "
 "sudo lxd init"
diff --git a/po/ja.po b/po/ja.po
index da6d56d..c755397 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: 2017-02-17 15:34+0000\n"
 "Last-Translator: KATOH Yasufumi <karma at jazz.email.ne.jp>\n"
 "Language-Team: Japanese <https://hosted.weblate.org/projects/linux-"
@@ -513,8 +513,8 @@ msgid "ISSUE DATE"
 msgstr ""
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+#, fuzzy
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr "初めて LXD を使う場合、sudo lxd init と実行する必要があります"
 
 #: lxc/main.go:43
diff --git a/po/lxd.pot b/po/lxd.pot
index 2a490ea..27de218 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: 2017-02-28 23:20-0500\n"
+        "POT-Creation-Date: 2017-02-28 23:57-0500\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"
@@ -449,7 +449,7 @@ msgid   "ISSUE DATE"
 msgstr  ""
 
 #: lxc/main.go:136
-msgid   "If this is your first time using LXD, you should also run: sudo lxd init"
+msgid   "If this is your first time using LXD, you should also run: lxd init"
 msgstr  ""
 
 #: lxc/main.go:43
diff --git a/po/nl.po b/po/nl.po
index 7fbbc08..424bacb 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: Automatically generated\n"
 "Language-Team: none\n"
@@ -471,8 +471,7 @@ msgid "ISSUE DATE"
 msgstr ""
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr ""
 
 #: lxc/main.go:43
diff --git a/po/ru.po b/po/ru.po
index 3830dec..618fdcc 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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: 2017-02-28 23:20-0500\n"
+"POT-Creation-Date: 2017-02-28 23:57-0500\n"
 "PO-Revision-Date: 2017-02-14 09:54+0000\n"
 "Last-Translator: Vyacheslav Razykov <v.razykov at gmail.com>\n"
 "Language-Team: Russian <https://hosted.weblate.org/projects/linux-containers/"
@@ -554,8 +554,7 @@ msgid "ISSUE DATE"
 msgstr ""
 
 #: lxc/main.go:136
-msgid ""
-"If this is your first time using LXD, you should also run: sudo lxd init"
+msgid "If this is your first time using LXD, you should also run: lxd init"
 msgstr ""
 
 #: lxc/main.go:43

From 01ad6da89262d15c527239211cbccc6231f5674e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 1 Mar 2017 21:12:10 -0500
Subject: [PATCH 3/3] shared/simplestreams: Improve error handling
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.go                             |  9 +++++++--
 lxd/daemon_images.go                  |  2 +-
 shared/simplestreams/simplestreams.go | 10 +++++-----
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/client.go b/client.go
index bc4ce80..0f2dd5f 100644
--- a/client.go
+++ b/client.go
@@ -1104,7 +1104,7 @@ func (c *Client) PostImage(imageFile string, rootfsFile string, properties []str
 
 func (c *Client) GetImageInfo(image string) (*api.Image, error) {
 	if c.Remote.Protocol == "simplestreams" && c.simplestreams != nil {
-		return c.simplestreams.GetImageInfo(image)
+		return c.simplestreams.GetImage(image)
 	}
 
 	resp, err := c.get(fmt.Sprintf("images/%s", image))
@@ -1262,7 +1262,12 @@ func (c *Client) IsAlias(alias string) (bool, error) {
 
 func (c *Client) GetAlias(alias string) string {
 	if c.Remote.Protocol == "simplestreams" && c.simplestreams != nil {
-		return c.simplestreams.GetAlias(alias)
+		alias, err := c.simplestreams.GetAlias(alias)
+		if err != nil {
+			return ""
+		}
+
+		return alias.Target
 	}
 
 	resp, err := c.get(fmt.Sprintf("images/aliases/%s", alias))
diff --git a/lxd/daemon_images.go b/lxd/daemon_images.go
index 0ae9e2f..b2bd825 100644
--- a/lxd/daemon_images.go
+++ b/lxd/daemon_images.go
@@ -356,7 +356,7 @@ func (d *Daemon) ImageDownload(op *operation, server string, protocol string, ce
 			return "", err
 		}
 
-		info, err := ss.GetImageInfo(fp)
+		info, err := ss.GetImage(fp)
 		if err != nil {
 			return "", err
 		}
diff --git a/shared/simplestreams/simplestreams.go b/shared/simplestreams/simplestreams.go
index 76b2e8e..efcb48f 100644
--- a/shared/simplestreams/simplestreams.go
+++ b/shared/simplestreams/simplestreams.go
@@ -600,21 +600,21 @@ func (s *SimpleStreams) ListImages() ([]api.Image, error) {
 	return images, err
 }
 
-func (s *SimpleStreams) GetAlias(name string) string {
+func (s *SimpleStreams) GetAlias(name string) (*api.ImageAliasesEntry, error) {
 	_, aliasesMap, err := s.getImages()
 	if err != nil {
-		return ""
+		return nil, err
 	}
 
 	alias, ok := aliasesMap[name]
 	if !ok {
-		return ""
+		return nil, fmt.Errorf("Alias '%s' doesn't exist", name)
 	}
 
-	return alias.Target
+	return alias, nil
 }
 
-func (s *SimpleStreams) GetImageInfo(fingerprint string) (*api.Image, error) {
+func (s *SimpleStreams) GetImage(fingerprint string) (*api.Image, error) {
 	images, _, err := s.getImages()
 	if err != nil {
 		return nil, err


More information about the lxc-devel mailing list