Typo and clarity fixes (#14081)

This commit is contained in:
VAL
2022-02-15 10:43:49 -08:00
committed by GitHub
parent 856235abb9
commit dae8a00f0c
16 changed files with 18 additions and 18 deletions

View File

@@ -51,7 +51,7 @@ func ensureTrailingSlash(s string) string {
return s return s
} }
// ensureNoTrailingSlash ensures the given string has a trailing slash. // ensureNoTrailingSlash ensures the given string does not have a trailing slash.
func ensureNoTrailingSlash(s string) string { func ensureNoTrailingSlash(s string) string {
s = strings.TrimSpace(s) s = strings.TrimSpace(s)
if s == "" { if s == "" {
@@ -64,7 +64,7 @@ func ensureNoTrailingSlash(s string) string {
return s return s
} }
// ensureNoLeadingSlash ensures the given string has a trailing slash. // ensureNoLeadingSlash ensures the given string does not have a leading slash.
func ensureNoLeadingSlash(s string) string { func ensureNoLeadingSlash(s string) string {
s = strings.TrimSpace(s) s = strings.TrimSpace(s)
if s == "" { if s == "" {

View File

@@ -138,7 +138,7 @@ func (c *KVDeleteCommand) deleteV2(path, mountPath string, client *api.Client) (
var secret *api.Secret var secret *api.Secret
switch { switch {
case len(c.flagVersions) > 0: case len(c.flagVersions) > 0:
path = addPrefixToVKVPath(path, mountPath, "delete") path = addPrefixToKVPath(path, mountPath, "delete")
if err != nil { if err != nil {
return nil, err return nil, err
} }
@@ -150,7 +150,7 @@ func (c *KVDeleteCommand) deleteV2(path, mountPath string, client *api.Client) (
secret, err = client.Logical().Write(path, data) secret, err = client.Logical().Write(path, data)
default: default:
path = addPrefixToVKVPath(path, mountPath, "data") path = addPrefixToKVPath(path, mountPath, "data")
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@@ -104,7 +104,7 @@ func (c *KVDestroyCommand) Run(args []string) int {
c.UI.Error("Destroy not supported on KV Version 1") c.UI.Error("Destroy not supported on KV Version 1")
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "destroy") path = addPrefixToKVPath(path, mountPath, "destroy")
if err != nil { if err != nil {
c.UI.Error(err.Error()) c.UI.Error(err.Error())
return 2 return 2

View File

@@ -102,7 +102,7 @@ func (c *KVGetCommand) Run(args []string) int {
var versionParam map[string]string var versionParam map[string]string
if v2 { if v2 {
path = addPrefixToVKVPath(path, mountPath, "data") path = addPrefixToKVPath(path, mountPath, "data")
if c.flagVersion > 0 { if c.flagVersion > 0 {
versionParam = map[string]string{ versionParam = map[string]string{

View File

@@ -105,7 +105,7 @@ func isKVv2(path string, client *api.Client) (string, bool, error) {
return mountPath, version == 2, nil return mountPath, version == 2, nil
} }
func addPrefixToVKVPath(p, mountPath, apiPrefix string) string { func addPrefixToKVPath(p, mountPath, apiPrefix string) string {
if p == mountPath || p == strings.TrimSuffix(mountPath, "/") { if p == mountPath || p == strings.TrimSuffix(mountPath, "/") {
return path.Join(mountPath, apiPrefix) return path.Join(mountPath, apiPrefix)
} }

View File

@@ -90,7 +90,7 @@ func (c *KVListCommand) Run(args []string) int {
} }
if v2 { if v2 {
path = addPrefixToVKVPath(path, mountPath, "metadata") path = addPrefixToKVPath(path, mountPath, "metadata")
if err != nil { if err != nil {
c.UI.Error(err.Error()) c.UI.Error(err.Error())
return 2 return 2

View File

@@ -83,7 +83,7 @@ func (c *KVMetadataDeleteCommand) Run(args []string) int {
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "metadata") path = addPrefixToKVPath(path, mountPath, "metadata")
if secret, err := client.Logical().Delete(path); err != nil { if secret, err := client.Logical().Delete(path); err != nil {
c.UI.Error(fmt.Sprintf("Error deleting %s: %s", path, err)) c.UI.Error(fmt.Sprintf("Error deleting %s: %s", path, err))
if secret != nil { if secret != nil {

View File

@@ -87,7 +87,7 @@ func (c *KVMetadataGetCommand) Run(args []string) int {
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "metadata") path = addPrefixToKVPath(path, mountPath, "metadata")
secret, err := client.Logical().Read(path) secret, err := client.Logical().Read(path)
if err != nil { if err != nil {
c.UI.Error(fmt.Sprintf("Error reading %s: %s", path, err)) c.UI.Error(fmt.Sprintf("Error reading %s: %s", path, err))

View File

@@ -151,7 +151,7 @@ func (c *KVMetadataPatchCommand) Run(args []string) int {
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "metadata") path = addPrefixToKVPath(path, mountPath, "metadata")
data := map[string]interface{}{} data := map[string]interface{}{}

View File

@@ -149,7 +149,7 @@ func (c *KVMetadataPutCommand) Run(args []string) int {
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "metadata") path = addPrefixToKVPath(path, mountPath, "metadata")
data := map[string]interface{}{} data := map[string]interface{}{}
if c.flagMaxVersions >= 0 { if c.flagMaxVersions >= 0 {

View File

@@ -159,7 +159,7 @@ func (c *KVPatchCommand) Run(args []string) int {
return 2 return 2
} }
path = addPrefixToVKVPath(path, mountPath, "data") path = addPrefixToKVPath(path, mountPath, "data")
if err != nil { if err != nil {
c.UI.Error(err.Error()) c.UI.Error(err.Error())
return 2 return 2

View File

@@ -130,7 +130,7 @@ func (c *KVPutCommand) Run(args []string) int {
} }
if v2 { if v2 {
path = addPrefixToVKVPath(path, mountPath, "data") path = addPrefixToKVPath(path, mountPath, "data")
data = map[string]interface{}{ data = map[string]interface{}{
"data": data, "data": data,
"options": map[string]interface{}{}, "options": map[string]interface{}{},

View File

@@ -115,7 +115,7 @@ func (c *KVRollbackCommand) Run(args []string) int {
return 2 return 2
} }
path = addPrefixToVKVPath(path, mountPath, "data") path = addPrefixToKVPath(path, mountPath, "data")
if err != nil { if err != nil {
c.UI.Error(err.Error()) c.UI.Error(err.Error())
return 2 return 2

View File

@@ -104,7 +104,7 @@ func (c *KVUndeleteCommand) Run(args []string) int {
return 1 return 1
} }
path = addPrefixToVKVPath(path, mountPath, "undelete") path = addPrefixToKVPath(path, mountPath, "undelete")
data := map[string]interface{}{ data := map[string]interface{}{
"versions": kvParseVersionsFlags(c.flagVersions), "versions": kvParseVersionsFlags(c.flagVersions),
} }

View File

@@ -4298,7 +4298,7 @@ func checkListingVisibility(visibility ListingVisibilityType) error {
case ListingVisibilityHidden: case ListingVisibilityHidden:
case ListingVisibilityUnauth: case ListingVisibilityUnauth:
default: default:
return fmt.Errorf("invalid listing visilibity type") return fmt.Errorf("invalid listing visibility type")
} }
return nil return nil

View File

@@ -89,7 +89,7 @@ These metrics represent operational aspects of the running Vault instance.
| `vault.core.activity.segment_write` | Duration of time taken writing activity log segments to storage. | ms | summary | | `vault.core.activity.segment_write` | Duration of time taken writing activity log segments to storage. | ms | summary |
| `vault.core.check_token` | Duration of time taken by token checks handled by Vault core | ms | summary | | `vault.core.check_token` | Duration of time taken by token checks handled by Vault core | ms | summary |
| `vault.core.fetch_acl_and_token` | Duration of time taken by ACL and corresponding token entry fetches handled by Vault core | ms | summary | | `vault.core.fetch_acl_and_token` | Duration of time taken by ACL and corresponding token entry fetches handled by Vault core | ms | summary |
| `vault.core.handle_request` | Duration of time taken by requests handled by Vault core | ms | summary | | `vault.core.handle_request` | Duration of time taken by non-login requests handled by Vault core | ms | summary |
| `vault.core.handle_login_request` | Duration of time taken by login requests handled by Vault core | ms | summary | | `vault.core.handle_login_request` | Duration of time taken by login requests handled by Vault core | ms | summary |
| `vault.core.in_flight_requests` | Number of in-flight requests. | requests | gauge | | `vault.core.in_flight_requests` | Number of in-flight requests. | requests | gauge |
| `vault.core.leadership_setup_failed` | Duration of time taken by cluster leadership setup failures which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary | | `vault.core.leadership_setup_failed` | Duration of time taken by cluster leadership setup failures which have occurred in a highly available Vault cluster. This should be monitored and alerted on for overall cluster leadership status. | ms | summary |