[lxc-devel] [lxd/master] lxc/{list,info}: Fix type on older LXD
stgraber on Github
lxc-bot at linuxcontainers.org
Mon Oct 7 18:48:07 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20191007/4748282e/attachment.bin>
-------------- next part --------------
From 3250632d02ffcc7761a5310e9295f9a6e9b7bb86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 7 Oct 2019 14:47:25 -0400
Subject: [PATCH] lxc/{list,info}: Fix type on older LXD
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>
---
lxc/info.go | 4 ++++
lxc/list.go | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/lxc/info.go b/lxc/info.go
index 95a119563d..d1bf736363 100644
--- a/lxc/info.go
+++ b/lxc/info.go
@@ -450,6 +450,10 @@ func (c *cmdInfo) containerInfo(d lxd.InstanceServer, remote config.Remote, name
fmt.Printf(i18n.G("Status: %s")+"\n", ct.Status)
+ if ct.Type == "" {
+ ct.Type = "container"
+ }
+
if ct.Ephemeral {
fmt.Printf(i18n.G("Type: %s (ephemeral)")+"\n", ct.Type)
} else {
diff --git a/lxc/list.go b/lxc/list.go
index 796251404f..1253b532ab 100644
--- a/lxc/list.go
+++ b/lxc/list.go
@@ -620,6 +620,10 @@ func (c *cmdList) IP6ColumnData(cInfo api.InstanceFull) string {
}
func (c *cmdList) typeColumnData(cInfo api.InstanceFull) string {
+ if cInfo.Type == "" {
+ cInfo.Type = "container"
+ }
+
if cInfo.Ephemeral {
return fmt.Sprintf("%s (%s)", strings.ToUpper(cInfo.Type), i18n.G("EPHEMERAL"))
}
More information about the lxc-devel
mailing list