From e171df2e2cd4f47ffe8e885abfc3832be1589682 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Fri, 6 Jun 2014 14:12:40 -0700 Subject: [PATCH] consul: Sort datacenter list. Fixes #198 --- consul/catalog_endpoint.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/consul/catalog_endpoint.go b/consul/catalog_endpoint.go index 51dc11bd01..9fb982e145 100644 --- a/consul/catalog_endpoint.go +++ b/consul/catalog_endpoint.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/armon/go-metrics" "github.com/hashicorp/consul/consul/structs" + "sort" "time" ) @@ -84,6 +85,9 @@ func (c *Catalog) ListDatacenters(args *struct{}, reply *[]string) error { dcs = append(dcs, dc) } + // Sort the DCs + sort.Strings(dcs) + // Return *reply = dcs return nil