From d0d85b461c0618f779d422aee11e732cbb210705 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 51dc11bd0..9fb982e14 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