[lxc-devel] [lxd/master] Have "device show" print yaml
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Mar 15 18:26:11 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/20160315/a38077c1/attachment.bin>
-------------- next part --------------
From e8c309a4d6036ff258fc945d0b5f3805b9d6ec90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 15 Mar 2016 14:25:21 -0400
Subject: [PATCH] Have "device show" print yaml
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/config.go | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lxc/config.go b/lxc/config.go
index 0f94945..1bece90 100644
--- a/lxc/config.go
+++ b/lxc/config.go
@@ -695,12 +695,12 @@ func (c *configCmd) deviceShow(config *lxd.Config, which string, args []string)
devices = resp.Devices
}
- for n, d := range devices {
- fmt.Printf("%s\n", n)
- for attr, val := range d {
- fmt.Printf(" %s: %s\n", attr, val)
- }
+ data, err := yaml.Marshal(&devices)
+ if err != nil {
+ return err
}
+ fmt.Printf(string(data))
+
return nil
}
More information about the lxc-devel
mailing list