From bedd0c5a9eb0d7c6c915ef9ea0c5675527e18b49 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 17 Aug 2016 11:29:09 -0700 Subject: [PATCH] Makes protocol version a little clearer. --- command/version.go | 13 +++++++++++-- website/source/docs/upgrading.html.markdown | 6 +++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/command/version.go b/command/version.go index 4e91214b99..b588d5c2c0 100644 --- a/command/version.go +++ b/command/version.go @@ -2,6 +2,7 @@ package command import ( "fmt" + "github.com/hashicorp/consul/command/agent" "github.com/hashicorp/consul/consul" "github.com/mitchellh/cli" ) @@ -18,8 +19,16 @@ func (c *VersionCommand) Help() string { func (c *VersionCommand) Run(_ []string) int { c.Ui.Output(fmt.Sprintf("Consul Version: %s", c.HumanVersion)) - c.Ui.Output(fmt.Sprintf("Supported Protocol Version(s): %d to %d", - consul.ProtocolVersionMin, consul.ProtocolVersionMax)) + + config := agent.DefaultConfig() + var supplement string + if config.Protocol < consul.ProtocolVersionMax { + supplement = fmt.Sprintf(" (agent will automatically use protocol >%d when speaking to compatible agents)", + config.Protocol) + } + c.Ui.Output(fmt.Sprintf("Protocol Version: speaks %d by default, understands %d to %d%s", + config.Protocol, consul.ProtocolVersionMin, consul.ProtocolVersionMax, supplement)) + return 0 } diff --git a/website/source/docs/upgrading.html.markdown b/website/source/docs/upgrading.html.markdown index ca95a090f2..80dd28bd18 100644 --- a/website/source/docs/upgrading.html.markdown +++ b/website/source/docs/upgrading.html.markdown @@ -73,12 +73,12 @@ running `consul -v`. You'll see output similar to that below: ``` $ consul -v -Consul v0.7.0 -Supported Protocol Version(s): 2 to 3 +Consul Version: v0.7.0 +Protocol Version: speaks 2 by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents) ``` This says the version of Consul as well as the protocol versions this -agent can understand. +agent speaks and can understand. Note that sometimes Consul will default to speak a lower protocol version than it understands, in order to ease compatibility with older agents. For