Update dependencies to add service fabric mesh via new azure-sdk-go
This commit is contained in:
4
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/decode.go
generated
vendored
4
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/decode.go
generated
vendored
@@ -60,7 +60,7 @@ func init() {
|
||||
// decode is the generic switcher that decides which decoder to use for a field
|
||||
func decode(src DataSource, dest reflect.Value, prefix string, depth recursion) (reflect.Value, error) {
|
||||
// if depth has reached zero, we skip decoding entirely
|
||||
if depth.depth == 0 {
|
||||
if depth.depth == 0 || depth.skipDecode {
|
||||
return dest, nil
|
||||
}
|
||||
depth.depth--
|
||||
@@ -445,7 +445,7 @@ func Decode(src DataSource, dest interface{}) interface{} {
|
||||
}
|
||||
|
||||
// #nosec: Errors unhandled.
|
||||
value, _ := decode(src, reflect.ValueOf(dest), DefaultPrefix, Unbounded)
|
||||
value, _ := decode(src, reflect.ValueOf(dest), "", Unbounded)
|
||||
|
||||
return value.Interface()
|
||||
}
|
||||
|
||||
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/decode_linux.go
generated
vendored
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/decode_linux.go
generated
vendored
@@ -42,7 +42,7 @@ func GuestInfoSourceWithPrefix(prefix string) (DataSource, error) {
|
||||
|
||||
source := func(key string) (string, error) {
|
||||
if key != GuestInfoSecretKey {
|
||||
key = addPrefixToKey(DefaultGuestInfoPrefix, prefix, key)
|
||||
key = addPrefixToKey(defaultGuestInfoPrefix(), prefix, key)
|
||||
}
|
||||
|
||||
value, err := guestinfo.String(key, "")
|
||||
|
||||
4
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/encode.go
generated
vendored
4
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/encode.go
generated
vendored
@@ -62,7 +62,7 @@ func init() {
|
||||
// decode is the generic switcher that decides which decoder to use for a field
|
||||
func encode(sink DataSink, src reflect.Value, prefix string, depth recursion) {
|
||||
// if depth has reached zero, we skip encoding entirely
|
||||
if depth.depth == 0 {
|
||||
if depth.depth == 0 || depth.skipEncode {
|
||||
return
|
||||
}
|
||||
depth.depth--
|
||||
@@ -258,7 +258,7 @@ type DataSink func(string, string) error
|
||||
|
||||
// Encode serializes the given type to the supplied data sink
|
||||
func Encode(sink DataSink, src interface{}) {
|
||||
encode(sink, reflect.ValueOf(src), DefaultPrefix, Unbounded)
|
||||
encode(sink, reflect.ValueOf(src), "", Unbounded)
|
||||
}
|
||||
|
||||
// EncodeWithPrefix serializes the given type to the supplied data sink, using
|
||||
|
||||
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/encode_linux.go
generated
vendored
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/encode_linux.go
generated
vendored
@@ -47,7 +47,7 @@ func GuestInfoSinkWithPrefix(prefix string) (DataSink, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
key = addPrefixToKey(DefaultGuestInfoPrefix, prefix, key)
|
||||
key = addPrefixToKey(defaultGuestInfoPrefix(), prefix, key)
|
||||
|
||||
if value == "" {
|
||||
value = "<nil>"
|
||||
|
||||
134
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/keys.go
generated
vendored
134
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/keys.go
generated
vendored
@@ -27,23 +27,64 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultTagName value
|
||||
// GuestInfoPrefix is dictated by vSphere
|
||||
GuestInfoPrefix = "guestinfo."
|
||||
|
||||
// ScopeTag is the tag name used for declaring scopes for a field
|
||||
ScopeTag = "scope"
|
||||
// KeyTag is the tag name by which to override default key naming based on field name
|
||||
KeyTag = "key"
|
||||
// RecurseTag is the tag name with which different recursion properties are declared
|
||||
RecurseTag = "recurse"
|
||||
|
||||
// HiddenScope means the key is hidden from the guest and will not have a GuestInfoPrefix
|
||||
HiddenScope = "hidden"
|
||||
// ReadOnlyScope means the key is read-only from the guest
|
||||
ReadOnlyScope = "read-only"
|
||||
// ReadWriteScope means the key may be read and modified by the guest
|
||||
ReadWriteScope = "read-write"
|
||||
// VolatileScope means that the value is expected to change and should be refreshed on use
|
||||
VolatileScope = "volatile"
|
||||
|
||||
// SecretSuffix means the value should be encrypted in the vmx.
|
||||
SecretSuffix = "secret"
|
||||
// NonPersistentSuffix means the key should only be written if the key will be deleted on guest power off.
|
||||
NonPersistentSuffix = "non-persistent"
|
||||
|
||||
// RecurseDepthProperty controls how deep to recuse into a structure field from this level. A value of zero
|
||||
// prevents both encode and decode of that field. This is provided to control recursion into unannotated structures.
|
||||
// This is unbounded if not specified.
|
||||
RecurseDepthProperty = "depth"
|
||||
// RecurseFollowProperty instructs encode and decode to follow pointers.
|
||||
RecurseFollowProperty = "follow"
|
||||
// RecurseNoFollowProperty instructs encode and decode not to follow pointers.
|
||||
RecurseNoFollowProperty = "nofollow"
|
||||
// RecurseSkipEncodeProperty causes the marked field and subfields to be skipped when encoding.
|
||||
RecurseSkipEncodeProperty = "skip-encode"
|
||||
// RecurseSkipDecodeProperty causes the marked field and subfields to be skipped when decoding.
|
||||
RecurseSkipDecodeProperty = "skip-decode"
|
||||
)
|
||||
|
||||
// TODO: this entire section of variables should be turned into a config struct
|
||||
// that can be passed to Encode and Decode, or that Encode and Decode are method on
|
||||
var (
|
||||
// DefaultTagName is the annotation tag name we use for basic semantic version. Not currently used.
|
||||
DefaultTagName = "vic"
|
||||
// DefaultPrefix value
|
||||
DefaultPrefix = ""
|
||||
// DefaultGuestInfoPrefix value
|
||||
DefaultGuestInfoPrefix = "guestinfo.vice."
|
||||
|
||||
// DefaultPrefix is prepended to generated key paths for basic namespacing
|
||||
DefaultPrefix = "vice."
|
||||
|
||||
//Separator for slice values and map keys
|
||||
Separator = "|"
|
||||
|
||||
// suffix separator character
|
||||
suffixSeparator = "@"
|
||||
// secret suffix
|
||||
secretSuffix = "secret"
|
||||
// non-persistent suffix
|
||||
nonpersistentSuffix = "non-persistent"
|
||||
)
|
||||
|
||||
func defaultGuestInfoPrefix() string {
|
||||
return GuestInfoPrefix + DefaultPrefix
|
||||
}
|
||||
|
||||
const (
|
||||
// Invalid value
|
||||
Invalid = 1 << iota
|
||||
@@ -51,6 +92,8 @@ const (
|
||||
Hidden
|
||||
// ReadOnly value
|
||||
ReadOnly
|
||||
// WriteOnly value
|
||||
WriteOnly
|
||||
// ReadWrite value
|
||||
ReadWrite
|
||||
// NonPersistent value
|
||||
@@ -66,6 +109,10 @@ type recursion struct {
|
||||
depth int
|
||||
// follow controls whether we follow pointers
|
||||
follow bool
|
||||
// set to skip decode of a field but still allow encode
|
||||
skipDecode bool
|
||||
// set to skip encode of a field but still allow decode
|
||||
skipEncode bool
|
||||
}
|
||||
|
||||
// Unbounded is the value used for unbounded recursion
|
||||
@@ -103,17 +150,17 @@ func calculateScope(scopes []string) uint {
|
||||
|
||||
for _, v := range scopes {
|
||||
switch v {
|
||||
case "hidden":
|
||||
case HiddenScope:
|
||||
scope |= Hidden
|
||||
case "read-only":
|
||||
case ReadOnlyScope:
|
||||
scope |= ReadOnly
|
||||
case "read-write":
|
||||
case ReadWriteScope:
|
||||
scope |= ReadWrite
|
||||
case nonpersistentSuffix:
|
||||
scope |= NonPersistent
|
||||
case "volatile":
|
||||
case VolatileScope:
|
||||
scope |= Volatile
|
||||
case secretSuffix:
|
||||
case NonPersistentSuffix:
|
||||
scope |= NonPersistent
|
||||
case SecretSuffix:
|
||||
scope |= Secret | ReadOnly
|
||||
default:
|
||||
return Invalid
|
||||
@@ -130,7 +177,7 @@ func isSecret(key string) bool {
|
||||
}
|
||||
|
||||
for i := range suffix[1:] {
|
||||
if suffix[i+1] == secretSuffix {
|
||||
if suffix[i+1] == SecretSuffix {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -146,7 +193,7 @@ func isNonPersistent(key string) bool {
|
||||
}
|
||||
|
||||
for i := range suffix[1:] {
|
||||
if suffix[i+1] == nonpersistentSuffix {
|
||||
if suffix[i+1] == NonPersistentSuffix {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -157,22 +204,22 @@ func isNonPersistent(key string) bool {
|
||||
func calculateScopeFromKey(key string) []string {
|
||||
scopes := []string{}
|
||||
|
||||
if !strings.HasPrefix(key, DefaultGuestInfoPrefix) {
|
||||
scopes = append(scopes, "hidden")
|
||||
if !strings.HasPrefix(key, GuestInfoPrefix) {
|
||||
scopes = append(scopes, HiddenScope)
|
||||
}
|
||||
|
||||
if strings.Contains(key, "/") {
|
||||
scopes = append(scopes, "read-only")
|
||||
scopes = append(scopes, ReadOnlyScope)
|
||||
} else {
|
||||
scopes = append(scopes, "read-write")
|
||||
scopes = append(scopes, ReadWriteScope)
|
||||
}
|
||||
|
||||
if isSecret(key) {
|
||||
scopes = append(scopes, secretSuffix)
|
||||
scopes = append(scopes, SecretSuffix)
|
||||
}
|
||||
|
||||
if isNonPersistent(key) {
|
||||
scopes = append(scopes, nonpersistentSuffix)
|
||||
scopes = append(scopes, NonPersistentSuffix)
|
||||
}
|
||||
|
||||
return scopes
|
||||
@@ -202,21 +249,21 @@ func calculateKeyFromField(field reflect.StructField, prefix string, depth recur
|
||||
// do we have DefaultTagName?
|
||||
if tags.Get(DefaultTagName) != "" {
|
||||
// get the scopes
|
||||
scopes = strings.Split(tags.Get("scope"), ",")
|
||||
scopes = strings.Split(tags.Get(ScopeTag), ",")
|
||||
logger.Debugf("Scopes: %#v", scopes)
|
||||
|
||||
// get the keys and split properties from it
|
||||
key = tags.Get("key")
|
||||
key = tags.Get(KeyTag)
|
||||
logger.Debugf("Key specified: %s", key)
|
||||
|
||||
// get the keys and split properties from it
|
||||
recurse := tags.Get("recurse")
|
||||
recurse := tags.Get(RecurseTag)
|
||||
if recurse != "" {
|
||||
props := strings.Split(recurse, ",")
|
||||
// process properties
|
||||
for _, prop := range props {
|
||||
// determine recursion depth
|
||||
if strings.HasPrefix(prop, "depth") {
|
||||
if strings.HasPrefix(prop, RecurseDepthProperty) {
|
||||
parts := strings.Split(prop, "=")
|
||||
if len(parts) != 2 {
|
||||
logger.Warnf("Skipping field with incorrect recurse property: %s", prop)
|
||||
@@ -229,10 +276,14 @@ func calculateKeyFromField(field reflect.StructField, prefix string, depth recur
|
||||
return "", skip
|
||||
}
|
||||
fdepth.depth = int(val)
|
||||
} else if prop == "nofollow" {
|
||||
} else if prop == RecurseNoFollowProperty {
|
||||
fdepth.follow = false
|
||||
} else if prop == "follow" {
|
||||
} else if prop == RecurseFollowProperty {
|
||||
fdepth.follow = true
|
||||
} else if prop == RecurseSkipDecodeProperty {
|
||||
fdepth.skipDecode = true
|
||||
} else if prop == RecurseSkipEncodeProperty {
|
||||
fdepth.skipEncode = true
|
||||
} else {
|
||||
logger.Warnf("Ignoring unknown recurse property %s (%s)", key, prop)
|
||||
continue
|
||||
@@ -278,7 +329,7 @@ func calculateKey(scope uint, prefix string, key string) string {
|
||||
|
||||
hide := scope&Hidden != 0
|
||||
write := scope&ReadWrite != 0
|
||||
visible := strings.HasPrefix(prefix, DefaultGuestInfoPrefix)
|
||||
visible := strings.HasPrefix(prefix, GuestInfoPrefix)
|
||||
|
||||
if !hide && write {
|
||||
oldSep = "/"
|
||||
@@ -298,7 +349,7 @@ func calculateKey(scope uint, prefix string, key string) string {
|
||||
}
|
||||
|
||||
if scope&Secret != 0 {
|
||||
out += suffixSeparator + secretSuffix
|
||||
out += suffixSeparator + SecretSuffix
|
||||
}
|
||||
|
||||
if scope&NonPersistent != 0 {
|
||||
@@ -306,7 +357,7 @@ func calculateKey(scope uint, prefix string, key string) string {
|
||||
logger.Debugf("Unable to combine non-persistent and hidden scopes")
|
||||
return ""
|
||||
}
|
||||
out += suffixSeparator + nonpersistentSuffix
|
||||
out += suffixSeparator + NonPersistentSuffix
|
||||
}
|
||||
|
||||
// we don't care about existing separators when hiden
|
||||
@@ -316,7 +367,7 @@ func calculateKey(scope uint, prefix string, key string) string {
|
||||
}
|
||||
|
||||
// strip the prefix and the leading r/w signifier
|
||||
return out[len(DefaultGuestInfoPrefix)+1:]
|
||||
return out[len(defaultGuestInfoPrefix())+1:]
|
||||
}
|
||||
|
||||
// ensure that separators are correct
|
||||
@@ -324,11 +375,11 @@ func calculateKey(scope uint, prefix string, key string) string {
|
||||
|
||||
// Assemble the base that controls key publishing in guest
|
||||
if !visible {
|
||||
return DefaultGuestInfoPrefix + newSep + out
|
||||
return defaultGuestInfoPrefix() + newSep + out
|
||||
}
|
||||
|
||||
// prefix will have been mangled by strings.Replace
|
||||
return DefaultGuestInfoPrefix + out[len(DefaultGuestInfoPrefix):]
|
||||
return defaultGuestInfoPrefix() + out[len(defaultGuestInfoPrefix()):]
|
||||
}
|
||||
|
||||
// utility function to allow adding of arbitrary prefix into key
|
||||
@@ -508,3 +559,14 @@ func calculateKeys(v reflect.Value, field string, prefix string) []string {
|
||||
func CalculateKeys(obj interface{}, field string, prefix string) []string {
|
||||
return calculateKeys(reflect.ValueOf(obj), field, prefix)
|
||||
}
|
||||
|
||||
// CalculateKey is a specific case of CalculateKeys that will panic if more than one key
|
||||
// matches the field pattern passed in.
|
||||
func CalculateKey(obj interface{}, field string, prefix string) string {
|
||||
keys := calculateKeys(reflect.ValueOf(obj), field, prefix)
|
||||
if len(keys) != 1 {
|
||||
panic("CalculateKey should only ever return one key")
|
||||
}
|
||||
|
||||
return keys[0]
|
||||
}
|
||||
|
||||
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/secret.go
generated
vendored
2
vendor/github.com/vmware/vic/pkg/vsphere/extraconfig/secret.go
generated
vendored
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
// The value of this key is hidden from API requests, but visible within the guest
|
||||
// #nosec: Potential hardcoded credentials
|
||||
const GuestInfoSecretKey = "guestinfo.ovfEnv"
|
||||
const GuestInfoSecretKey = GuestInfoPrefix + "ovfEnv"
|
||||
|
||||
// SecretKey provides helpers to encrypt/decrypt extraconfig values
|
||||
type SecretKey struct {
|
||||
|
||||
52
vendor/github.com/vmware/vic/pkg/vsphere/session/session.go
generated
vendored
52
vendor/github.com/vmware/vic/pkg/vsphere/session/session.go
generated
vendored
@@ -226,6 +226,9 @@ func (s *Session) Connect(ctx context.Context) (*Session, error) {
|
||||
}
|
||||
|
||||
soapClient.UserAgent = s.UserAgent
|
||||
if s.UserAgent == "" {
|
||||
op.Debug("DEVNOTICE: Session created with default user agent.")
|
||||
}
|
||||
|
||||
soapClient.SetThumbprint(soapURL.Host, s.Thumbprint)
|
||||
|
||||
@@ -366,10 +369,46 @@ func (s *Session) Populate(ctx context.Context) (*Session, error) {
|
||||
op.Debugf("Cached pool: %s", s.PoolPath)
|
||||
}
|
||||
|
||||
err = s.setDatacenterFolders(op)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Sprintf("Failure finding folders (%s): %s", s.DatacenterPath, err.Error()))
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
op.Debugf("Error count populating vSphere cache: (%d)", len(errs))
|
||||
return nil, errors.New(strings.Join(errs, "\n"))
|
||||
}
|
||||
op.Debug("vSphere resource cache populated...")
|
||||
return s, nil
|
||||
}
|
||||
|
||||
func (s *Session) SetDatacenter(op trace.Operation, datacenter *object.Datacenter) error {
|
||||
s.Datacenter = datacenter
|
||||
s.Finder.SetDatacenter(datacenter)
|
||||
|
||||
if datacenter == nil {
|
||||
s.DatacenterPath = ""
|
||||
return nil
|
||||
}
|
||||
|
||||
s.DatacenterPath = datacenter.InventoryPath
|
||||
|
||||
// Do what Populate would have done if datacenterPath were set
|
||||
err := s.setDatacenterFolders(op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Session) setDatacenterFolders(op trace.Operation) error {
|
||||
var err error
|
||||
|
||||
if s.Datacenter != nil {
|
||||
folders, err := s.Datacenter.Folders(op)
|
||||
if err != nil {
|
||||
errs = append(errs, fmt.Sprintf("Failure finding folders (%s): %s", s.DatacenterPath, err.Error()))
|
||||
folders, e := s.Datacenter.Folders(op)
|
||||
if e != nil {
|
||||
err = e
|
||||
} else {
|
||||
op.Debugf("Cached folders: %s", s.DatacenterPath)
|
||||
}
|
||||
@@ -384,12 +423,7 @@ func (s *Session) Populate(ctx context.Context) (*Session, error) {
|
||||
s.VCHFolder = folders.VmFolder
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
op.Debugf("Error count populating vSphere cache: (%d)", len(errs))
|
||||
return nil, errors.New(strings.Join(errs, "\n"))
|
||||
}
|
||||
op.Debug("vSphere resource cache populated...")
|
||||
return s, nil
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *Session) logEnvironmentInfo(op trace.Operation) {
|
||||
|
||||
Reference in New Issue
Block a user