[lxc-devel] [lxd/master] sort addresses in `lxc list` output

tych0 on Github lxc-bot at linuxcontainers.org
Fri Jan 13 10:26:41 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 445 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170113/acf1058b/attachment.bin>
-------------- next part --------------
From c73e430764bfe0d370620a02c683504ff4b9bf0b Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Fri, 13 Jan 2017 12:25:39 +0200
Subject: [PATCH] sort addresses in `lxc list` output

This closes an issue in a different repo: https://github.com/lxc/lxc/issues/1383

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 lxc/list.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lxc/list.go b/lxc/list.go
index 8ec0a16..1fd9317 100644
--- a/lxc/list.go
+++ b/lxc/list.go
@@ -537,6 +537,7 @@ func (c *listCmd) IP4ColumnData(cInfo api.Container, cState *api.ContainerState,
 				}
 			}
 		}
+		sort.Sort(sort.Reverse(sort.StringSlice(ipv4s)))
 		return strings.Join(ipv4s, "\n")
 	} else {
 		return ""
@@ -561,6 +562,7 @@ func (c *listCmd) IP6ColumnData(cInfo api.Container, cState *api.ContainerState,
 				}
 			}
 		}
+		sort.Sort(sort.Reverse(sort.StringSlice(ipv6s)))
 		return strings.Join(ipv6s, "\n")
 	} else {
 		return ""


More information about the lxc-devel mailing list