Skip to content

Commit ac740b1

Browse files
tenthirtyamlbajolet-hashicorp
authored andcommitted
fix: run once command list
Updates RunOnceCommandList to a slice of strings `[]string` and updates 'guiRunOnce()` to pass "" if no commands are provided. This will ensure that the function addresses each case. Ref: #419 Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
1 parent a03ab4c commit ac740b1

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

.web-docs/components/builder/vsphere-clone/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ Example of usage:
458458

459459
<!-- Code generated from the comments of the WindowsOptions struct in builder/vsphere/clone/step_customize.go; DO NOT EDIT MANUALLY -->
460460

461-
- `run_once_command_list` (\*[]string) - Specifies a list of commands to run at first logon after the guest operating system is customized.
461+
- `run_once_command_list` ([]string) - Specifies a list of commands to run at first logon after the guest operating system is customized.
462462

463463
- `auto_logon` (\*bool) - Specifies whether the guest operating system automatically logs on as Administrator.
464464

builder/vsphere/clone/step_customize.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type LinuxOptions struct {
8282

8383
type WindowsOptions struct {
8484
// Specifies a list of commands to run at first logon after the guest operating system is customized.
85-
RunOnceCommandList *[]string `mapstructure:"run_once_command_list"`
85+
RunOnceCommandList []string `mapstructure:"run_once_command_list"`
8686
// Specifies whether the guest operating system automatically logs on as Administrator.
8787
AutoLogon *bool `mapstructure:"auto_logon"`
8888
// Specifies how many times the guest operating system should auto-logon the Administrator account when `auto_logon` is set to `true`. Default:s to `1`.
@@ -389,11 +389,14 @@ func (w *WindowsOptions) sysprep() *types.CustomizationSysprep {
389389
}
390390

391391
func (w *WindowsOptions) guiRunOnce() *types.CustomizationGuiRunOnce {
392-
if w.RunOnceCommandList == nil || len(*w.RunOnceCommandList) < 1 {
393-
return nil
392+
if w.RunOnceCommandList == nil || len(w.RunOnceCommandList) == 0 {
393+
return &types.CustomizationGuiRunOnce{
394+
CommandList: []string{""},
395+
}
394396
}
397+
395398
return &types.CustomizationGuiRunOnce{
396-
CommandList: *w.RunOnceCommandList,
399+
CommandList: w.RunOnceCommandList,
397400
}
398401
}
399402

docs-partials/builder/vsphere/clone/WindowsOptions-not-required.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Code generated from the comments of the WindowsOptions struct in builder/vsphere/clone/step_customize.go; DO NOT EDIT MANUALLY -->
22

3-
- `run_once_command_list` (\*[]string) - Specifies a list of commands to run at first logon after the guest operating system is customized.
3+
- `run_once_command_list` ([]string) - Specifies a list of commands to run at first logon after the guest operating system is customized.
44

55
- `auto_logon` (\*bool) - Specifies whether the guest operating system automatically logs on as Administrator.
66

0 commit comments

Comments
 (0)