[lxc-devel] [lxd/master] Issues/6275

srados on Github lxc-bot at linuxcontainers.org
Sun Oct 13 00:04:06 UTC 2019


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/20191012/bb5c35ab/attachment.bin>
-------------- next part --------------
From b33af43639695d555dd584e578cac6c51d557ebc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sava=20Rado=C5=A1?= <sava at bitsfactory.com>
Date: Sat, 12 Oct 2019 23:42:46 +0000
Subject: [PATCH 1/2] lxd/list: Modify parseColumns to allow for the
 config:KEY:NAME:WIDTH syntax
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sava Radoš <sava at bitsfactory.com>
---
 lxc/list.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lxc/list.go b/lxc/list.go
index 1253b532ab..e06e358c9b 100644
--- a/lxc/list.go
+++ b/lxc/list.go
@@ -478,6 +478,9 @@ func (c *cmdList) parseColumns(clustered bool) ([]column, bool, error) {
 			}
 		} else {
 			cc := strings.Split(columnEntry, ":")
+			if cc[0] == "config" {
+				cc = append(cc[:0], cc[1:]...)
+			}
 			if len(cc) > 3 {
 				return nil, false, fmt.Errorf(i18n.G("Invalid config key column format (too many fields): '%s'"), columnEntry)
 			}

From e34ae9afa537b5a8666cb8ee2d855e7713e493d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sava=20Rado=C5=A1?= <sava at bitsfactory.com>
Date: Sun, 13 Oct 2019 00:02:39 +0000
Subject: [PATCH 2/2] lxd/list: Modify TestColumns to allow for the
 config:KEY:NAME:WIDTH syntax
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sava Radoš <sava at bitsfactory.com>
---
 lxc/list_test.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lxc/list_test.go b/lxc/list_test.go
index 3b64f273a9..3d2f357b8e 100644
--- a/lxc/list_test.go
+++ b/lxc/list_test.go
@@ -59,6 +59,7 @@ func TestColumns(t *testing.T) {
 	keys := make([]string, 0, len(shared.KnownContainerConfigKeys))
 	for k := range shared.KnownContainerConfigKeys {
 		keys = append(keys, k)
+		keys = append(keys, "config:"+k)
 	}
 
 	randShorthand := func(buffer *bytes.Buffer) {


More information about the lxc-devel mailing list