Add flag to disable OvfEnvironment transport
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-03-02 15:48:10 +01:00
parent 5c12ec5b93
commit a2028a7d3b
3 changed files with 12 additions and 8 deletions

View File

@ -16,7 +16,7 @@ type vAPPProperty struct {
Value string
}
func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacenter, virtualmachine, network string) error {
func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacenter, virtualmachine, network string, ovftransport bool) error {
finder := find.NewFinder(clt, true)
dc, err := finder.Datacenter(ctx, datacenter)
@ -33,8 +33,11 @@ func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacen
var moref mo.VirtualMachine
vm.Properties(ctx, vm.Reference(), []string{"config.vAppConfig"}, &moref)
vappconfig := &types.VmConfigSpec{
OvfEnvironmentTransport: []string{"com.vmware.guestInfo"},
vappconfig := &types.VmConfigSpec{}
if ovftransport == true {
vappconfig = &types.VmConfigSpec{
OvfEnvironmentTransport: []string{"com.vmware.guestInfo"},
}
}
currentvappproperties := moref.Config.VAppConfig.GetVmConfigInfo().Property