Update vmware/govmomi vendor: add vapi package

Zones implementation for vSphere cloud provider needs dependencies
which are not included in current vmware/govmomi vendor. So this
update added "vapi" package to support zones.
This commit is contained in:
jiatongw
2018-08-03 13:24:51 -07:00
parent 99abd4bc79
commit 5c44fd871f
41 changed files with 2046 additions and 283 deletions

View File

@@ -77,6 +77,17 @@ type Client struct {
var schemeMatch = regexp.MustCompile(`^\w+://`)
type errInvalidCACertificate struct {
File string
}
func (e errInvalidCACertificate) Error() string {
return fmt.Sprintf(
"invalid certificate '%s', cannot be used as a trusted CA certificate",
e.File,
)
}
// ParseURL is wrapper around url.Parse, where Scheme defaults to "https" and Path defaults to "/sdk"
func ParseURL(s string) (*url.URL, error) {
var err error
@@ -200,7 +211,11 @@ func (c *Client) SetRootCAs(file string) error {
return err
}
pool.AppendCertsFromPEM(pem)
if ok := pool.AppendCertsFromPEM(pem); !ok {
return errInvalidCACertificate{
File: name,
}
}
}
c.t.TLSClientConfig.RootCAs = pool