Revert OvfTransport changes;Add vApp enabled check
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-03-03 10:23:23 +01:00
parent aa2224db43
commit 7ccc722aa5
3 changed files with 30 additions and 32 deletions

View File

@ -16,7 +16,7 @@ type vAPPProperty struct {
Value string
}
func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacenter, virtualmachine, network string, disableovftransport bool) error {
func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacenter, virtualmachine, network string) error {
finder := find.NewFinder(clt, true)
dc, err := finder.Datacenter(ctx, datacenter)
@ -36,31 +36,31 @@ func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacen
vappconfig := &types.VmConfigSpec{
OvfEnvironmentTransport: []string{"com.vmware.guestInfo"},
}
if disableovftransport == true {
vappconfig = &types.VmConfigSpec{}
}
currentvappproperties := moref.Config.VAppConfig.GetVmConfigInfo().Property
for _, vappproperty := range currentvappproperties {
vappconfig.Property = append(vappconfig.Property, types.VAppPropertySpec{
ArrayUpdateSpec: types.ArrayUpdateSpec{
Operation: types.ArrayUpdateOperationAdd,
},
Info: &types.VAppPropertyInfo{
Key: vappproperty.Key,
ClassId: vappproperty.ClassId,
InstanceId: vappproperty.InstanceId,
Id: vappproperty.Id,
Category: vappproperty.Category,
Label: vappproperty.Label,
Type: vappproperty.Type,
TypeReference: vappproperty.TypeReference,
UserConfigurable: vappproperty.UserConfigurable,
DefaultValue: vappproperty.DefaultValue,
Value: vappproperty.Value,
Description: vappproperty.Description,
},
})
currentvappproperties := []types.VAppPropertyInfo{}
if moref.Config != nil {
currentvappproperties = moref.Config.VAppConfig.GetVmConfigInfo().Property
for _, vappproperty := range currentvappproperties {
vappconfig.Property = append(vappconfig.Property, types.VAppPropertySpec{
ArrayUpdateSpec: types.ArrayUpdateSpec{
Operation: types.ArrayUpdateOperationAdd,
},
Info: &types.VAppPropertyInfo{
Key: vappproperty.Key,
ClassId: vappproperty.ClassId,
InstanceId: vappproperty.InstanceId,
Id: vappproperty.Id,
Category: vappproperty.Category,
Label: vappproperty.Label,
Type: vappproperty.Type,
TypeReference: vappproperty.TypeReference,
UserConfigurable: vappproperty.UserConfigurable,
DefaultValue: vappproperty.DefaultValue,
Value: vappproperty.Value,
Description: vappproperty.Description,
},
})
}
}
newvappproperties := []vAPPProperty{