[lxc-devel] [lxd/master] Fix all the bugs

stgraber on Github lxc-bot at linuxcontainers.org
Mon Apr 18 14:50:01 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/20160418/f02c1804/attachment.bin>
-------------- next part --------------
From 85ba871719b44036a6a7d231cf2d7391ae41ed56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 18 Apr 2016 13:57:42 +0100
Subject: [PATCH 1/3] list: Handle empty responses
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #1903

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc/list.go | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lxc/list.go b/lxc/list.go
index e0cfd6c..2c1f48c 100644
--- a/lxc/list.go
+++ b/lxc/list.go
@@ -399,7 +399,7 @@ func (c *listCmd) statusColumnData(cInfo shared.ContainerInfo, cState *shared.Co
 }
 
 func (c *listCmd) IP4ColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
-	if cInfo.IsActive() && cState.Network != nil {
+	if cInfo.IsActive() && cState != nil && cState.Network != nil {
 		ipv4s := []string{}
 		for netName, net := range cState.Network {
 			if net.Type == "loopback" {
@@ -423,7 +423,7 @@ func (c *listCmd) IP4ColumnData(cInfo shared.ContainerInfo, cState *shared.Conta
 }
 
 func (c *listCmd) IP6ColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
-	if cInfo.IsActive() && cState.Network != nil {
+	if cInfo.IsActive() && cState != nil && cState.Network != nil {
 		ipv6s := []string{}
 		for netName, net := range cState.Network {
 			if net.Type == "loopback" {
@@ -455,11 +455,15 @@ func (c *listCmd) typeColumnData(cInfo shared.ContainerInfo, cState *shared.Cont
 }
 
 func (c *listCmd) numberSnapshotsColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
-	return fmt.Sprintf("%d", len(cSnaps))
+	if cSnaps != nil {
+		return fmt.Sprintf("%d", len(cSnaps))
+	}
+
+	return ""
 }
 
 func (c *listCmd) PIDColumnData(cInfo shared.ContainerInfo, cState *shared.ContainerState, cSnaps []shared.SnapshotInfo) string {
-	if cInfo.IsActive() {
+	if cInfo.IsActive() && cState != nil {
 		return fmt.Sprintf("%d", cState.Pid)
 	}
 

From ac3ffcd29d6f6b5e73feb8621606e20314e62c6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 18 Apr 2016 15:38:39 +0100
Subject: [PATCH 2/3] Fail when removing non-existent profiles
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes: #1886

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/profiles.go | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lxd/profiles.go b/lxd/profiles.go
index 16d563e..6cbbf0f 100644
--- a/lxd/profiles.go
+++ b/lxd/profiles.go
@@ -259,10 +259,15 @@ func profilePost(d *Daemon, r *http.Request) Response {
 // The handler for the delete operation.
 func profileDelete(d *Daemon, r *http.Request) Response {
 	name := mux.Vars(r)["name"]
-	err := dbProfileDelete(d.db, name)
 
+	_, err := doProfileGet(d, name)
 	if err != nil {
-		return InternalError(err)
+		return SmartError(err)
+	}
+
+	err = dbProfileDelete(d.db, name)
+	if err != nil {
+		return SmartError(err)
 	}
 
 	return EmptySyncResponse

From f58cbb0cc4e51d36ec43b9e6c00b1ba50b9e60d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 18 Apr 2016 15:48:40 +0100
Subject: [PATCH 3/3] Document --alias to image import
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #1900

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc/image.go | 2 +-
 po/lxd.pot   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lxc/image.go b/lxc/image.go
index cf333a6..752b9c6 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -108,7 +108,7 @@ Images can be referenced by their full hash, shortest unique partial
 hash or alias name (if one is set).
 
 
-lxc image import <tarball> [rootfs tarball|URL] [remote:] [--public] [--created-at=ISO-8601] [--expires-at=ISO-8601] [--fingerprint=FINGERPRINT] [prop=value]
+lxc image import <tarball> [rootfs tarball|URL] [remote:] [--public] [--created-at=ISO-8601] [--expires-at=ISO-8601] [--fingerprint=FINGERPRINT] [--alias=ALIAS].. [prop=value]
     Import an image tarball (or tarballs) into the LXD image store.
 
 lxc image copy [remote:]<image> <remote>: [--alias=ALIAS].. [--copy-aliases] [--public] [--auto-update]
diff --git a/po/lxd.pot b/po/lxd.pot
index e828098..98cf83f 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-04-11 15:01-0400\n"
+        "POT-Creation-Date: 2016-04-18 15:47+0100\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"
@@ -622,7 +622,7 @@ msgid   "Manipulate container images.\n"
         "hash or alias name (if one is set).\n"
         "\n"
         "\n"
-        "lxc image import <tarball> [rootfs tarball|URL] [remote:] [--public] [--created-at=ISO-8601] [--expires-at=ISO-8601] [--fingerprint=FINGERPRINT] [prop=value]\n"
+        "lxc image import <tarball> [rootfs tarball|URL] [remote:] [--public] [--created-at=ISO-8601] [--expires-at=ISO-8601] [--fingerprint=FINGERPRINT] [--alias=ALIAS].. [prop=value]\n"
         "    Import an image tarball (or tarballs) into the LXD image store.\n"
         "\n"
         "lxc image copy [remote:]<image> <remote>: [--alias=ALIAS].. [--copy-aliases] [--public] [--auto-update]\n"


More information about the lxc-devel mailing list