Skip to content

Commit

Permalink
Apply code formatting recommendations.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKeiKun authored and tenthirtyam committed Apr 2, 2024
1 parent 510bffa commit bc9617e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
2 changes: 2 additions & 0 deletions .web-docs/components/builder/vsphere-iso/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ boot time.

- `destroy` (bool) - Specifies whether to destroy the virtual machine after the build is complete.

- `vapp` (vAppConfig) - Set the vApp properties for a virtual machine.

<!-- End of code generated from the comments of the CreateConfig struct in builder/vsphere/iso/step_create.go; -->


Expand Down
25 changes: 13 additions & 12 deletions builder/vsphere/driver/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,19 @@ type NIC struct {
}

type CreateConfig struct {
Annotation string
Name string
Folder string
Cluster string
Host string
ResourcePool string
Datastore string
GuestOS string // example: otherGuest
NICs []NIC
USBController []string
Version uint // example: 10
StorageConfig StorageConfig
Annotation string
Name string
Folder string
Cluster string
Host string
ResourcePool string
Datastore string
GuestOS string // example: otherGuest
NICs []NIC
USBController []string
Version uint // example: 10
StorageConfig StorageConfig
VAppProperties map[string]string
}

func (d *VCenterDriver) NewVM(ref *types.ManagedObjectReference) VirtualMachine {
Expand Down
7 changes: 4 additions & 3 deletions builder/vsphere/iso/step_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: MPL-2.0

//go:generate packer-sdc struct-markdown
//go:generate packer-sdc mapstructure-to-hcl2 -type NIC,CreateConfig
//go:generate packer-sdc mapstructure-to-hcl2 -type NIC,CreateConfig,vAppConfig

package iso

Expand Down Expand Up @@ -110,7 +110,8 @@ type CreateConfig struct {
Notes string `mapstructure:"notes"`
// Specifies whether to destroy the virtual machine after the build is complete.
Destroy bool `mapstructure:"destroy"`
VAppConfig vAppConfig `mapstructure:"vapp"`
// Set the vApp properties for a virtual machine.
VAppConfig vAppConfig `mapstructure:"vapp"`
}

func (c *CreateConfig) Prepare() []error {
Expand Down Expand Up @@ -197,7 +198,7 @@ func (s *StepCreateVM) Run(_ context.Context, state multistep.StateBag) multiste
}

vm, err := d.CreateVM(&driver.CreateConfig{
VAppProperties: s.Config.VAppConfig.Properties,
VAppProperties: s.Config.VAppConfig.Properties,
StorageConfig: driver.StorageConfig{
DiskControllerType: s.Config.StorageConfig.DiskControllerType,
Storage: disks,
Expand Down
2 changes: 1 addition & 1 deletion builder/vsphere/iso/step_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ func driverCreateConfig(config *CreateConfig, location *common.LocationConfig) *
}

return &driver.CreateConfig{
VAppProperties: config.VAppConfig.Properties,
VAppProperties: config.VAppConfig.Properties,
StorageConfig: driver.StorageConfig{
DiskControllerType: config.StorageConfig.DiskControllerType,
Storage: disks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@

- `destroy` (bool) - Specifies whether to destroy the virtual machine after the build is complete.

- `vapp` (vAppConfig) - Set the vApp properties for a virtual machine.

<!-- End of code generated from the comments of the CreateConfig struct in builder/vsphere/iso/step_create.go; -->
11 changes: 11 additions & 0 deletions docs-partials/builder/vsphere/iso/vAppConfig-not-required.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Code generated from the comments of the vAppConfig struct in builder/vsphere/iso/step_create.go; DO NOT EDIT MANUALLY -->

- `properties` (map[string]string) - Set values for the available vApp Properties to supply configuration parameters to a virtual machine cloned from
a template that came from an imported OVF or OVA file.

-> **Note:** The only supported usage path for vApp properties is for existing user-configurable keys.
These generally come from an existing template that was created from an imported OVF or OVA file.
You cannot set values for vApp properties on virtual machines created from scratch,
virtual machines lacking a vApp configuration, or on property keys that do not exist.

<!-- End of code generated from the comments of the vAppConfig struct in builder/vsphere/iso/step_create.go; -->

0 comments on commit bc9617e

Please sign in to comment.