Merge pull request #814 from amshinde/fix-endpoint-indexing

network: Sort endpoints by name
This commit is contained in:
Archana Shinde
2018-10-11 14:38:32 -07:00
committed by GitHub

View File

@@ -16,6 +16,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"runtime" "runtime"
"sort"
"strings" "strings"
"time" "time"
@@ -1670,6 +1671,12 @@ func createEndpointsFromScan(networkNSPath string, config NetworkConfig) ([]Endp
idx++ idx++
} }
sort.Slice(endpoints, func(i, j int) bool {
return endpoints[i].Name() < endpoints[j].Name()
})
networkLogger().WithField("endpoints", endpoints).Info("Endpoints found after scan")
return endpoints, nil return endpoints, nil
} }