Remove the string 'Vault' from version information

This commit is contained in:
vishalnayak 2016-09-01 14:54:04 -04:00
parent 8f6dfdcf49
commit 9c78c58948
7 changed files with 25 additions and 10 deletions

View file

@ -441,7 +441,7 @@ func (c *ServerCommand) Run(args []string) int {
}()
infoKeys = append(infoKeys, "version")
info["version"] = version.GetVersion().String()
info["version"] = version.GetVersion().FullVersionNumber()
// Server configuration output
padding := 24

View file

@ -16,7 +16,7 @@ func (c *VersionCommand) Help() string {
}
func (c *VersionCommand) Run(_ []string) int {
c.Ui.Output(c.VersionInfo.String())
c.Ui.Output(c.VersionInfo.FullVersionNumber())
return 0
}

View file

@ -140,7 +140,7 @@ func getSysHealth(core *vault.Core, r *http.Request) (int, *HealthResponse, erro
Sealed: sealed,
Standby: standby,
ServerTimeUTC: time.Now().UTC().Unix(),
Version: version.GetVersion().String(),
Version: version.GetVersion().VersionNumber(),
ClusterName: clusterName,
ClusterID: clusterID,
}

View file

@ -186,7 +186,7 @@ func handleSysSealStatusRaw(core *vault.Core, w http.ResponseWriter, r *http.Req
T: sealConfig.SecretThreshold,
N: sealConfig.SecretShares,
Progress: core.SecretProgress(),
Version: version.GetVersion().String(),
Version: version.GetVersion().VersionNumber(),
ClusterName: clusterName,
ClusterID: clusterID,
})

View file

@ -38,12 +38,27 @@ func GetVersion() *VersionInfo {
}
}
func (c *VersionInfo) String() string {
func (c *VersionInfo) VersionNumber() string {
if Version == "unknown" && VersionPrerelease == "unknown" {
return "(version unknown)"
}
version := fmt.Sprintf("v%s", c.Version)
if c.VersionPrerelease != "" {
version = fmt.Sprintf("%s-%s", version, c.VersionPrerelease)
}
return version
}
func (c *VersionInfo) FullVersionNumber() string {
var versionString bytes.Buffer
if Version == "unknown" && VersionPrerelease == "unknown" {
fmt.Fprintf(&versionString, "Vault (version unknown)")
return "Vault (version unknown)"
}
fmt.Fprintf(&versionString, "Vault v%s", c.Version)
if c.VersionPrerelease != "" {
fmt.Fprintf(&versionString, "-%s", c.VersionPrerelease)

View file

@ -63,7 +63,7 @@ description: |-
{
"cluster_id": "c9abceea-4f46-4dab-a688-5ce55f89e228",
"cluster_name": "vault-cluster-5515c810",
"version": "Vault v0.6.1-dev ('f76c926b0a36e55e71190eb3e2da312f29aca54e+CHANGES')",
"version": "v0.6.1-dev"
"server_time_utc": 1469555798,
"standby": false,
"sealed": false,

View file

@ -32,11 +32,11 @@ description: |-
"t": 3,
"n": 5,
"progress": 2,
"version": "Vault v0.6.1"
"version": "v0.6.1-dev"
}
```
Sample response when the unseal finishes.
Sample response when Vault is unsealed.
```javascript
{
@ -44,7 +44,7 @@ description: |-
"t": 3,
"n": 5,
"progress": 0,
"version": "Vault v0.6.1",
"version": "v0.6.1-dev",
"cluster_name": "vault-cluster-d6ec3c7f",
"cluster_id": "3e8b3fec-3749-e056-ba41-b62a63b997e8"
}