Add flag to disable OvfEnvironment transport
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5c12ec5b93
commit
a2028a7d3b
@ -3,7 +3,7 @@ type: kubernetes
|
|||||||
name: 'Golang Build'
|
name: 'Golang Build'
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
BINARY_VERSION: v0.5.0
|
BINARY_VERSION: v0.5.1
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
disable: true
|
disable: true
|
||||||
|
@ -28,9 +28,10 @@ var Commands struct {
|
|||||||
Force bool `short:"f" long:"force"`
|
Force bool `short:"f" long:"force"`
|
||||||
} // `command:"datacenter" alias:"dc" description:"Define a Network Protocol Profile within a datacenter"`
|
} // `command:"datacenter" alias:"dc" description:"Define a Network Protocol Profile within a datacenter"`
|
||||||
VirtualMachine struct {
|
VirtualMachine struct {
|
||||||
Name string `short:"n" long:"name" description:"Name of virtual machine" required:"true"`
|
Name string `short:"n" long:"name" description:"Name of virtual machine" required:"true"`
|
||||||
Datacenter string `long:"datacenter" description:"Name of datacenter" required:"true"`
|
Datacenter string `long:"datacenter" description:"Name of datacenter" required:"true"`
|
||||||
Network string `long:"portgroup" description:"Name of network portgroup" required:"true"`
|
Network string `long:"portgroup" description:"Name of network portgroup" required:"true"`
|
||||||
|
OvfTransport bool `long:"ovftransport" description:"Enable the OVF transport 'VMware Tools'" default:"true"`
|
||||||
} // `command:"virtualmachine" alias:"vm" description:"Configure a virtual machine for usage of Network Protocol Profiles"`
|
} // `command:"virtualmachine" alias:"vm" description:"Configure a virtual machine for usage of Network Protocol Profiles"`
|
||||||
GuestOS struct {
|
GuestOS struct {
|
||||||
} // `command:"guestos" alias:"os" description:"Configure guest OS network with allocated IP address"`
|
} // `command:"guestos" alias:"os" description:"Configure guest OS network with allocated IP address"`
|
||||||
@ -71,7 +72,7 @@ func main() {
|
|||||||
case "guestos", "os":
|
case "guestos", "os":
|
||||||
// TODO
|
// TODO
|
||||||
case "virtualmachine", "vm":
|
case "virtualmachine", "vm":
|
||||||
if err := hypervisor.SetVirtualMachineProperties(ctx, clt, Commands.VirtualMachine.Datacenter, Commands.VirtualMachine.Name, Commands.VirtualMachine.Network); err != nil {
|
if err := hypervisor.SetVirtualMachineProperties(ctx, clt, Commands.VirtualMachine.Datacenter, Commands.VirtualMachine.Name, Commands.VirtualMachine.Network, Commands.VirtualMachine.OvfTransport); err != nil {
|
||||||
log.Fatalf("[ERROR] Could not apply vApp properties: %s", err)
|
log.Fatalf("[ERROR] Could not apply vApp properties: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ type vAPPProperty struct {
|
|||||||
Value string
|
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)
|
finder := find.NewFinder(clt, true)
|
||||||
|
|
||||||
dc, err := finder.Datacenter(ctx, datacenter)
|
dc, err := finder.Datacenter(ctx, datacenter)
|
||||||
@ -33,8 +33,11 @@ func SetVirtualMachineProperties(ctx context.Context, clt *vim25.Client, datacen
|
|||||||
var moref mo.VirtualMachine
|
var moref mo.VirtualMachine
|
||||||
vm.Properties(ctx, vm.Reference(), []string{"config.vAppConfig"}, &moref)
|
vm.Properties(ctx, vm.Reference(), []string{"config.vAppConfig"}, &moref)
|
||||||
|
|
||||||
vappconfig := &types.VmConfigSpec{
|
vappconfig := &types.VmConfigSpec{}
|
||||||
OvfEnvironmentTransport: []string{"com.vmware.guestInfo"},
|
if ovftransport == true {
|
||||||
|
vappconfig = &types.VmConfigSpec{
|
||||||
|
OvfEnvironmentTransport: []string{"com.vmware.guestInfo"},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentvappproperties := moref.Config.VAppConfig.GetVmConfigInfo().Property
|
currentvappproperties := moref.Config.VAppConfig.GetVmConfigInfo().Property
|
||||||
|
Loading…
Reference in New Issue
Block a user