mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 18:43:34 +00:00
rebase: update github.com/hashicorp/vault/sdk to latest
The github.com/hashicorp/vault/sdk was listed in the replace section, most likely because using a newer version failed. By adding a missing tagged version to the `exclude` section in go.mod, updating the package works fine. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
committed by
mergify[bot]
parent
6d3e25f069
commit
9bd9f5e91d
7
vendor/github.com/hashicorp/vault/sdk/helper/consts/replication.go
generated
vendored
7
vendor/github.com/hashicorp/vault/sdk/helper/consts/replication.go
generated
vendored
@ -1,9 +1,9 @@
|
||||
package consts
|
||||
|
||||
const (
|
||||
//N.B. This needs to be excluded from replication despite the name; it's
|
||||
//merely saying that this is cluster information for the replicated
|
||||
//cluster.
|
||||
// N.B. This needs to be excluded from replication despite the name; it's
|
||||
// merely saying that this is cluster information for the replicated
|
||||
// cluster.
|
||||
CoreReplicatedClusterPrefix = "core/cluster/replicated/"
|
||||
CoreReplicatedClusterPrefixDR = "core/cluster/replicated-dr/"
|
||||
|
||||
@ -45,7 +45,6 @@ const (
|
||||
|
||||
// We verify no change to the above values are made
|
||||
func init() {
|
||||
|
||||
if OldReplicationBootstrapping != 3 {
|
||||
panic("Replication Constants have changed")
|
||||
}
|
||||
|
79
vendor/github.com/hashicorp/vault/sdk/helper/parseutil/parseutil.go
generated
vendored
79
vendor/github.com/hashicorp/vault/sdk/helper/parseutil/parseutil.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
@ -14,6 +15,84 @@ import (
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
var validCapacityString = regexp.MustCompile("^[\t ]*([0-9]+)[\t ]?([kmgtKMGT][iI]?[bB])?[\t ]*$")
|
||||
|
||||
// ParseCapacityString parses a capacity string and returns the number of bytes it represents.
|
||||
// Capacity strings are things like 5gib or 10MB. Supported prefixes are kb, kib, mb, mib, gb,
|
||||
// gib, tb, tib, which are not case sensitive. If no prefix is present, the number is assumed
|
||||
// to be in bytes already.
|
||||
func ParseCapacityString(in interface{}) (uint64, error) {
|
||||
var cap uint64
|
||||
|
||||
jsonIn, ok := in.(json.Number)
|
||||
if ok {
|
||||
in = jsonIn.String()
|
||||
}
|
||||
|
||||
switch inp := in.(type) {
|
||||
case nil:
|
||||
// return default of zero
|
||||
case string:
|
||||
if inp == "" {
|
||||
return cap, nil
|
||||
}
|
||||
|
||||
matches := validCapacityString.FindStringSubmatch(inp)
|
||||
|
||||
// no sub-groups means we couldn't parse it
|
||||
if len(matches) <= 1 {
|
||||
return cap, errors.New("could not parse capacity from input")
|
||||
}
|
||||
|
||||
var multiplier uint64 = 1
|
||||
switch strings.ToLower(matches[2]) {
|
||||
case "kb":
|
||||
multiplier = 1000
|
||||
case "kib":
|
||||
multiplier = 1024
|
||||
case "mb":
|
||||
multiplier = 1000 * 1000
|
||||
case "mib":
|
||||
multiplier = 1024 * 1024
|
||||
case "gb":
|
||||
multiplier = 1000 * 1000 * 1000
|
||||
case "gib":
|
||||
multiplier = 1024 * 1024 * 1024
|
||||
case "tb":
|
||||
multiplier = 1000 * 1000 * 1000 * 1000
|
||||
case "tib":
|
||||
multiplier = 1024 * 1024 * 1024 * 1024
|
||||
}
|
||||
|
||||
size, err := strconv.ParseUint(matches[1], 10, 64)
|
||||
if err != nil {
|
||||
return cap, err
|
||||
}
|
||||
|
||||
cap = size * multiplier
|
||||
case int:
|
||||
cap = uint64(inp)
|
||||
case int32:
|
||||
cap = uint64(inp)
|
||||
case int64:
|
||||
cap = uint64(inp)
|
||||
case uint:
|
||||
cap = uint64(inp)
|
||||
case uint32:
|
||||
cap = uint64(inp)
|
||||
case uint64:
|
||||
cap = uint64(inp)
|
||||
case float32:
|
||||
cap = uint64(inp)
|
||||
case float64:
|
||||
cap = uint64(inp)
|
||||
default:
|
||||
return cap, errors.New("could not parse capacity from input")
|
||||
}
|
||||
|
||||
return cap, nil
|
||||
}
|
||||
|
||||
func ParseDurationSecond(in interface{}) (time.Duration, error) {
|
||||
var dur time.Duration
|
||||
jsonIn, ok := in.(json.Number)
|
||||
|
33
vendor/github.com/hashicorp/vault/sdk/helper/strutil/strutil.go
generated
vendored
33
vendor/github.com/hashicorp/vault/sdk/helper/strutil/strutil.go
generated
vendored
@ -32,6 +32,16 @@ func StrListContains(haystack []string, needle string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// StrListContainsCaseInsensitive looks for a string in a list of strings.
|
||||
func StrListContainsCaseInsensitive(haystack []string, needle string) bool {
|
||||
for _, item := range haystack {
|
||||
if strings.EqualFold(item, needle) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// StrListSubset checks if a given list is a subset
|
||||
// of another set
|
||||
func StrListSubset(super, sub []string) bool {
|
||||
@ -445,3 +455,26 @@ func Difference(a, b []string, lowercase bool) []string {
|
||||
sort.Strings(items)
|
||||
return items
|
||||
}
|
||||
|
||||
// GetString attempts to retrieve a value from the provided map and assert that it is a string. If the key does not
|
||||
// exist in the map, this will return an empty string. If the key exists, but the value is not a string type, this will
|
||||
// return an error. If no map or key is provied, this will return an error
|
||||
func GetString(m map[string]interface{}, key string) (string, error) {
|
||||
if m == nil {
|
||||
return "", fmt.Errorf("missing map")
|
||||
}
|
||||
if key == "" {
|
||||
return "", fmt.Errorf("missing key")
|
||||
}
|
||||
|
||||
rawVal, ok := m[key]
|
||||
if !ok {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
str, ok := rawVal.(string)
|
||||
if !ok {
|
||||
return "", fmt.Errorf("invalid value at %s: is a %T", key, rawVal)
|
||||
}
|
||||
return str, nil
|
||||
}
|
||||
|
3
vendor/modules.txt
vendored
3
vendor/modules.txt
vendored
@ -171,7 +171,7 @@ github.com/hashicorp/vault/command/agent/auth/kubernetes
|
||||
# github.com/hashicorp/vault/api v1.1.1
|
||||
## explicit
|
||||
github.com/hashicorp/vault/api
|
||||
# github.com/hashicorp/vault/sdk v0.2.1 => github.com/hashicorp/vault/sdk v0.1.14-0.20201116234512-b4d4137dfe8b
|
||||
# github.com/hashicorp/vault/sdk v0.2.1
|
||||
github.com/hashicorp/vault/sdk/helper/compressutil
|
||||
github.com/hashicorp/vault/sdk/helper/consts
|
||||
github.com/hashicorp/vault/sdk/helper/hclutil
|
||||
@ -1067,7 +1067,6 @@ sigs.k8s.io/yaml
|
||||
# code.cloudfoundry.org/gofileutils => github.com/cloudfoundry/gofileutils v0.0.0-20170111115228-4d0c80011a0f
|
||||
# github.com/ceph/ceph-csi/api => ./api
|
||||
# github.com/golang/protobuf => github.com/golang/protobuf v1.4.3
|
||||
# github.com/hashicorp/vault/sdk => github.com/hashicorp/vault/sdk v0.1.14-0.20201116234512-b4d4137dfe8b
|
||||
# github.com/portworx/sched-ops => github.com/portworx/sched-ops v0.20.4-openstorage-rc3
|
||||
# gomodules.xyz/jsonpatch/v2 => github.com/gomodules/jsonpatch/v2 v2.2.0
|
||||
# k8s.io/api => k8s.io/api v0.22.2
|
||||
|
Reference in New Issue
Block a user