summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-14 16:05:42 +0100
committerGitHub <noreply@github.com>2021-12-14 16:05:42 +0100
commitc501c1d6423759d9180bfe254d1bbe7662d89868 (patch)
tree1051c349f6c7c88987d1b94cc156f8e717b2a07f /cmd
parent4a060caeabc7061b85a290ba31f87af7d4dbf508 (diff)
parent5f1f62f0bb7465cf935ea4353cf5afaa03f633af (diff)
downloadpodman-c501c1d6423759d9180bfe254d1bbe7662d89868.tar.gz
podman-c501c1d6423759d9180bfe254d1bbe7662d89868.tar.bz2
podman-c501c1d6423759d9180bfe254d1bbe7662d89868.zip
Merge pull request #12585 from Luap99/network-ls-sort
network ls: show networks in deterministic order
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/networks/list.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index 6f1a7742a..7ce566225 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -3,6 +3,7 @@ package network
import (
"fmt"
"os"
+ "sort"
"strings"
"github.com/containers/common/pkg/completion"
@@ -73,6 +74,11 @@ func networkList(cmd *cobra.Command, args []string) error {
return err
}
+ // sort the networks to make sure the order is deterministic
+ sort.Slice(responses, func(i, j int) bool {
+ return responses[i].Name < responses[j].Name
+ })
+
switch {
// quiet means we only print the network names
case networkListOptions.Quiet: