Configure CI;Add network name flag;Add list of properties
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
2022-12-22 14:16:44 +01:00
parent c8483de7a9
commit b85fd3946e
5 changed files with 69 additions and 16 deletions

View File

@ -9,19 +9,21 @@ import (
"spamasaurus.com/m/pkg/hypervisor"
)
type Input struct {
VirtualMachine string
Network string
}
func main() {
var virtualmachine string
var input Input
flag.StringVar(&virtualmachine, "vm", "", "name of VM")
flag.StringVar(&input.VirtualMachine, "vm", "", "name of VM")
flag.StringVar(&input.Network, "network", "", "name of network portgroup")
flag.Parse()
if virtualmachine == "" {
log.Fatalf("Name of vm is required")
}
cfg, err := config.NewConfig()
if err != nil {
log.Fatal(err)
log.Fatalf("Invalid configuration: %s", err)
}
ctx, cancel := context.WithCancel(context.Background())
@ -37,7 +39,7 @@ func main() {
log.Fatalf("Foo indeed: %s", err)
}
if err := hypervisor.SetVirtualMachineProperties(ctx, fnd, virtualmachine); err != nil {
if err := hypervisor.SetVirtualMachineProperties(ctx, fnd, input.VirtualMachine, input.Network); err != nil {
log.Fatalf("Could not apply vApp properties: %s", err)
}
}