Skip to content

fix error when self-admin and no patch-window-id provided

George Bowen requested to merge gb93-fix-patchwindow-sysadmin-validation into main

When no patch-window-id is provided the system defaults to -1 (which is any). This validator should check if we are explicitly 0 or excluded which would be -1. Maybe this isn't the best way to solve this problem though...

example error (windows/pwsh):

clockworksctl.exe create vm geo-win11-test-dev.vm.duke.edu `
     --os self-admin-windows-11-version-23h2 `
     --fund-code 000-9332 `
     --location "Fitz East" `
     --sysadmin-option self-admin `
     --cpu 2 --ram 4 --disk 50 `
     --container OIT-SSI-Windows `
     --storage-type bronze

panic: only specify a patch window when not a self-admin request

goroutine 1 [running]:
gitlab.oit.duke.edu/devil-ops/go-clockworks/clockworks.NewVMCreateOpts[...]({0xc0000b2000, 0x13, 0x8})
        gitlab.oit.duke.edu/devil-ops/go-clockworks@v1.11.0/clockworks/vm.go:449 +0x226
gitlab.oit.duke.edu/devil-ops/go-clockworks/clockworks.(*Client).VMCreateOptsWithCmd(0xc0001b8000, 0xc0001b4608, {0xc000236500?, 0x0?, 0x0?})
        gitlab.oit.duke.edu/devil-ops/go-clockworks@v1.11.0/clockworks/cobra.go:144 +0xe8f
gitlab.oit.duke.edu/devil-ops/clockworksctl/cmd/clockworksctl/cmd.NewCreateVMCmd.func1(0xc0001b4608, {0xc000236500, 0x1, 0x13})
        gitlab.oit.duke.edu/devil-ops/clockworksctl/cmd/clockworksctl/cmd/create_vm.go:37 +0x1a5
github.com/spf13/cobra.(*Command).execute(0xc0001b4608, {0xc0002363c0, 0x13, 0x13})
        github.com/spf13/cobra@v1.8.1/command.go:985 +0xaca
github.com/spf13/cobra.(*Command).ExecuteC(0xc0001a0308)
        github.com/spf13/cobra@v1.8.1/command.go:1117 +0x3ff
github.com/spf13/cobra.(*Command).Execute(0xc00006e000?)
        github.com/spf13/cobra@v1.8.1/command.go:1041 +0x13
main.main()
        gitlab.oit.duke.edu/devil-ops/clockworksctl/cmd/clockworksctl/main.go:13 +0x18

Merge request reports

Loading