Skip to content

Commit

Permalink
Merge PR hashicorp#9078: Add go version to server message output
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored May 26, 2020
1 parent 0417266 commit f425d5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CHANGES:

IMPROVEMENTS:

* core: Add the Go version used to build a Vault binary to the server message output. [[GH-9078](https://github.com/hashicorp/vault/pull/9078)]
* cli: Support reading TLS parameters from file for the `vault operator raft join` command. [[GH-9060](https://github.com/hashicorp/vault/pull/9060)]
* plugin: Add SDK method, `Sys.ReloadPlugin`, and CLI command, `vault plugin reload`,
for reloading plugins. [[GH-8777](https://github.com/hashicorp/vault/pull/8777)]
Expand Down
21 changes: 21 additions & 0 deletions command/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ func (c *ServerCommand) runRecoveryMode() int {
infoKeys = append(infoKeys, "version")
verInfo := version.GetVersion()
info["version"] = verInfo.FullVersionNumber(false)

if verInfo.Revision != "" {
info["version sha"] = strings.Trim(verInfo.Revision, "'")
infoKeys = append(infoKeys, "version sha")
Expand All @@ -599,17 +600,23 @@ func (c *ServerCommand) runRecoveryMode() int {
infoKeys = append(infoKeys, "recovery mode")
info["recovery mode"] = "true"

infoKeys = append(infoKeys, "go version")
info["go version"] = runtime.Version()

// Server configuration output
padding := 24

sort.Strings(infoKeys)
c.UI.Output("==> Vault server configuration:\n")

for _, k := range infoKeys {
c.UI.Output(fmt.Sprintf(
"%s%s: %s",
strings.Repeat(" ", padding-len(k)),
strings.Title(k),
info[k]))
}

c.UI.Output("")

for _, ln := range lns {
Expand Down Expand Up @@ -1479,6 +1486,7 @@ CLUSTER_SYNTHESIS_COMPLETE:
info["version sha"] = strings.Trim(verInfo.Revision, "'")
infoKeys = append(infoKeys, "version sha")
}

infoKeys = append(infoKeys, "cgo")
info["cgo"] = "disabled"
if version.CgoEnabled {
Expand All @@ -1488,17 +1496,23 @@ CLUSTER_SYNTHESIS_COMPLETE:
infoKeys = append(infoKeys, "recovery mode")
info["recovery mode"] = "false"

infoKeys = append(infoKeys, "go version")
info["go version"] = runtime.Version()

// Server configuration output
padding := 24

sort.Strings(infoKeys)
c.UI.Output("==> Vault server configuration:\n")

for _, k := range infoKeys {
c.UI.Output(fmt.Sprintf(
"%s%s: %s",
strings.Repeat(" ", padding-len(k)),
strings.Title(k),
info[k]))
}

c.UI.Output("")

// Tests might not want to start a vault server and just want to verify
Expand Down Expand Up @@ -2037,23 +2051,30 @@ func (c *ServerCommand) enableThreeNodeDevCluster(base *vault.CoreConfig, info m
info["version sha"] = strings.Trim(verInfo.Revision, "'")
infoKeys = append(infoKeys, "version sha")
}

infoKeys = append(infoKeys, "cgo")
info["cgo"] = "disabled"
if version.CgoEnabled {
info["cgo"] = "enabled"
}

infoKeys = append(infoKeys, "go version")
info["go version"] = runtime.Version()

// Server configuration output
padding := 24

sort.Strings(infoKeys)
c.UI.Output("==> Vault server configuration:\n")

for _, k := range infoKeys {
c.UI.Output(fmt.Sprintf(
"%s%s: %s",
strings.Repeat(" ", padding-len(k)),
strings.Title(k),
info[k]))
}

c.UI.Output("")

for _, core := range testCluster.Cores {
Expand Down

0 comments on commit f425d5b

Please sign in to comment.