Skip to content

Commit e06412d

Browse files
authored
Merge pull request #2023 from killianmuldoon/pr-remove-esxi-client
🐛 Return error on session creation if VCentre client not used
2 parents a9ae01e + 0fc3047 commit e06412d

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

pkg/services/govmomi/create.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@ limitations under the License.
1717
package govmomi
1818

1919
import (
20+
"github.com/pkg/errors"
2021
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
2122

2223
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/context"
23-
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/esxi"
2424
"sigs.k8s.io/cluster-api-provider-vsphere/pkg/services/govmomi/vcenter"
2525
)
2626

2727
// createVM creates a new VM with the data in the VMContext passed. This method does not wait
2828
// for the new VM to be created.
2929
func createVM(ctx *context.VMContext, bootstrapData []byte, format bootstrapv1.Format) error {
30-
if ctx.Session.IsVC() {
31-
return vcenter.Clone(ctx, bootstrapData, format)
30+
if !ctx.Session.IsVC() {
31+
return errors.Errorf("expected VCenter client got %v", ctx.Session.ServiceContent.About.ApiType)
3232
}
33-
return esxi.Clone(ctx, bootstrapData, format)
33+
return vcenter.Clone(ctx, bootstrapData, format)
3434
}

pkg/services/govmomi/esxi/clone.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)