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 Nov 8, 2023
1 parent 8faec49 commit 67d7936
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 @@ -791,6 +791,8 @@ boot time.

- `destroy` (bool) - If set to true, the VM will be destroyed after the builder completes

- `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 @@ -117,18 +117,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 @@ -95,7 +95,8 @@ type CreateConfig struct {
Notes string `mapstructure:"notes"`
// If set to true, the VM will be destroyed after the builder completes
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 @@ -182,7 +183,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 @@ -17,4 +17,6 @@

- `destroy` (bool) - If set to true, the VM will be destroyed after the builder completes

- `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 67d7936

Please sign in to comment.