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