[lxc-devel] [lxd/master] Show the snapshot name instead of the path

stgraber on Github lxc-bot at linuxcontainers.org
Sat Apr 9 16:00:36 UTC 2016


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/20160409/e55cf524/attachment.bin>
-------------- next part --------------
From b30eeb2089b766052124682feed8c6e85fbf6913 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 9 Apr 2016 12:00:11 -0400
Subject: [PATCH] Show the snapshot name instead of the path
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 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxc/info.go b/lxc/info.go
index f09669f..6cb617b 100644
--- a/lxc/info.go
+++ b/lxc/info.go
@@ -193,7 +193,9 @@ func (c *infoCmd) containerInfo(d *lxd.Client, name string, showLog bool) error
 		if first_snapshot {
 			fmt.Println(i18n.G("Snapshots:"))
 		}
-		fmt.Printf("  %s", snap.Name)
+
+		fields := strings.Split(snap.Name, shared.SnapshotDelimiter)
+		fmt.Printf("  %s", fields[len(fields)-1])
 
 		if snap.CreationDate.UTC().Unix() != 0 {
 			fmt.Printf(" ("+i18n.G("taken at %s")+")", snap.CreationDate.UTC().Format(layout))


More information about the lxc-devel mailing list