@@ -53,8 +53,6 @@ const (
53
53
envVimVersion = "GOVC_VIM_VERSION"
54
54
envTLSCaCerts = "GOVC_TLS_CA_CERTS"
55
55
envTLSKnownHosts = "GOVC_TLS_KNOWN_HOSTS"
56
-
57
- defaultMinVimVersion = "5.5"
58
56
)
59
57
60
58
const cDescr = "ESX or vCenter URL"
@@ -69,7 +67,6 @@ type ClientFlag struct {
69
67
cert string
70
68
key string
71
69
persist bool
72
- minAPIVersion string
73
70
vimNamespace string
74
71
vimVersion string
75
72
tlsCaCerts string
@@ -167,15 +164,6 @@ func (flag *ClientFlag) Register(ctx context.Context, f *flag.FlagSet) {
167
164
f .BoolVar (& flag .persist , "persist-session" , persist , usage )
168
165
}
169
166
170
- {
171
- env := os .Getenv (envMinAPIVersion )
172
- if env == "" {
173
- env = defaultMinVimVersion
174
- }
175
-
176
- flag .minAPIVersion = env
177
- }
178
-
179
167
{
180
168
value := os .Getenv (envVimNamespace )
181
169
if value == "" {
@@ -310,45 +298,6 @@ func (flag *ClientFlag) SetRootCAs(c *soap.Client) error {
310
298
return nil
311
299
}
312
300
313
- func isDevelopmentVersion (apiVersion string ) bool {
314
- // Skip version check for development builds which can be in the form of "r4A70F" or "6.5.x"
315
- return strings .Count (apiVersion , "." ) == 0 || strings .HasSuffix (apiVersion , ".x" )
316
- }
317
-
318
- // apiVersionValid returns whether or not the API version supported by the
319
- // server the client is connected to is not recent enough.
320
- func apiVersionValid (c * vim25.Client , minVersionString string ) error {
321
- if minVersionString == "-" {
322
- // Disable version check
323
- return nil
324
- }
325
-
326
- apiVersion := c .ServiceContent .About .ApiVersion
327
- if isDevelopmentVersion (apiVersion ) {
328
- return nil
329
- }
330
-
331
- realVersion , err := ParseVersion (apiVersion )
332
- if err != nil {
333
- return fmt .Errorf ("error parsing API version %q: %s" , apiVersion , err )
334
- }
335
-
336
- minVersion , err := ParseVersion (minVersionString )
337
- if err != nil {
338
- return fmt .Errorf ("error parsing %s=%q: %s" , envMinAPIVersion , minVersionString , err )
339
- }
340
-
341
- if ! minVersion .Lte (realVersion ) {
342
- err = fmt .Errorf ("require API version %q, connected to API version %q (set %s to override)" ,
343
- minVersionString ,
344
- c .ServiceContent .About .ApiVersion ,
345
- envMinAPIVersion )
346
- return err
347
- }
348
-
349
- return nil
350
- }
351
-
352
301
func (flag * ClientFlag ) RoundTripper (c * soap.Client ) soap.RoundTripper {
353
302
// Retry twice when a temporary I/O error occurs.
354
303
// This means a maximum of 3 attempts.
@@ -375,12 +324,6 @@ func (flag *ClientFlag) Client() (*vim25.Client, error) {
375
324
return nil , err
376
325
}
377
326
378
- // Check that the endpoint has the right API version
379
- err = apiVersionValid (c , flag .minAPIVersion )
380
- if err != nil {
381
- return nil , err
382
- }
383
-
384
327
if flag .vimVersion == "" || flag .vimVersion == "-" {
385
328
err = c .UseServiceVersion ()
386
329
if err != nil {
0 commit comments