[lxc-devel] [lxd/master] lxc/image: add new column shorthand char 'F' that displays the full image hash/fingerprint
TerraTech on Github
lxc-bot at linuxcontainers.org
Sun Sep 23 01:28:59 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1088 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180923/19c8f25c/attachment.bin>
-------------- next part --------------
From eb7db100b87bb72adefbee5b7116fcbbdc65c123 Mon Sep 17 00:00:00 2001
From: fqbuild <TerraTech at users.noreply.github.com>
Date: Fri, 21 Sep 2018 02:42:53 -0400
Subject: [PATCH] lxc/image: add new column shorthand char 'F' that displays
the full image hash/fingerprint
* This is useful for shell scripts wanting the full image hash from csv output.
$ lxc image list -clF
+---------------------+------------------------------------------------------------------+
| ALIAS | FINGERPRINT |
+---------------------+------------------------------------------------------------------+
| alpine/3.4 (3 more) | cc8b580121227c92e05123e00cc52046b0139253db2c7a034234915f05a43eeb |
+---------------------+------------------------------------------------------------------+
$ lxc image list -clF --format=csv
alpine/3.4 (3 more),cc8b580121227c92e05123e00cc52046b0139253db2c7a034234915f05a43eeb
Signed-off-by: fqbuild <TerraTech at users.noreply.github.com>
---
lxc/image.go | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/lxc/image.go b/lxc/image.go
index 4d9272ffad..5a603e4eaa 100644
--- a/lxc/image.go
+++ b/lxc/image.go
@@ -915,7 +915,8 @@ Column shorthand chars:
l - Shortest image alias (and optionally number of other aliases)
L - Newline-separated list of all image aliases
- f - Fingerprint
+ f - Fingerprint (short)
+ F - Fingerprint (long)
p - Whether image is public
d - Description
a - Architecture
@@ -933,6 +934,7 @@ func (c *cmdImageList) parseColumns() ([]imageColumn, error) {
'l': {i18n.G("ALIAS"), c.aliasColumnData},
'L': {i18n.G("ALIASES"), c.aliasesColumnData},
'f': {i18n.G("FINGERPRINT"), c.fingerprintColumnData},
+ 'F': {i18n.G("FINGERPRINT"), c.fingerprintFullColumnData},
'p': {i18n.G("PUBLIC"), c.publicColumnData},
'd': {i18n.G("DESCRIPTION"), c.descriptionColumnData},
'a': {i18n.G("ARCH"), c.architectureColumnData},
@@ -982,6 +984,10 @@ func (c *cmdImageList) fingerprintColumnData(image api.Image) string {
return image.Fingerprint[0:12]
}
+func (c *cmdImageList) fingerprintFullColumnData(image api.Image) string {
+ return image.Fingerprint
+}
+
func (c *cmdImageList) publicColumnData(image api.Image) string {
if image.Public {
return i18n.G("yes")
More information about the lxc-devel
mailing list