hashicorp / packer-plugin-vsphere

Packer plugin for VMware vSphere Builder
https://www.packer.io/docs/builders/vsphere
Mozilla Public License 2.0
93 stars 91 forks source link

fix: run once command list #427

Closed tenthirtyam closed 2 months ago

tenthirtyam commented 2 months ago

Summary

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.

Testing

Basic:

➜  packer-plugin-vsphere git:(fix/run-once-command-list) make generate             
2024/05/09 22:24:23 Copying "docs" to ".docs/"
2024/05/09 22:24:23 Replacing @include '...' calls in .docs/
Compiling MDX docs in '.docs' to Markdown in '.web-docs'...
➜  packer-plugin-vsphere git:(fix/run-once-command-list) make build
➜  packer-plugin-vsphere git:(fix/run-once-command-list) make test
?       github.com/hashicorp/packer-plugin-vsphere      [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common/testing       [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/examples/driver      [no test files]
?       github.com/hashicorp/packer-plugin-vsphere/version      [no test files]
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/clone        2.923s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/common       2.614s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/driver       7.161s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/iso  4.477s
ok      github.com/hashicorp/packer-plugin-vsphere/builder/vsphere/supervisor   8.391s
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere       3.897s
ok      github.com/hashicorp/packer-plugin-vsphere/post-processor/vsphere-template      4.728s
➜  packer-plugin-vsphere git:(fix/run-once-command-list) 

Scenarios:

run_once_command_list not provided. ✅ run_once_command_list [] used. ✅ run_once_command_list [""] used. ✅ run_once_command_list ["command1", "command2"] used.

Reference

Closes #419

tenthirtyam commented 2 months ago

Sure, I can happily split it out today.

tenthirtyam commented 2 months ago

Simplified in 2a31f38, @lbajolet-hashicorp.

tenthirtyam commented 2 months ago

Posted the other half of the split from the original commit.