Skip to content

Commit

Permalink
Port the fix for ovf_flags to my all fix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
hmalphettes committed May 7, 2022
1 parent 9ea1550 commit 194d805
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
3 changes: 3 additions & 0 deletions builder/vsphere/common/step_import_to_content_library.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ type ContentLibraryDestinationConfig struct {
Ovf bool `mapstructure:"ovf"`
// When set to true, the VM won't be imported to the content library item. Useful for setting to `true` during a build test stage. Defaults to `false`.
SkipImport bool `mapstructure:"skip_import"`
// Flags to use for OVF package creation. The supported flags can be obtained using ExportFlag.list. If unset, no flags will be used. Known values: EXTRA_CONFIG, PRESERVE_MAC
OvfFlags []string `mapstructure:"ovf_flags"`
}

func (c *ContentLibraryDestinationConfig) Prepare(lc *LocationConfig) []error {
Expand Down Expand Up @@ -171,6 +173,7 @@ func (s *StepImportToContentLibrary) importOvfTemplate(vm *driver.VirtualMachine
Spec: vcenter.CreateSpec{
Name: s.ContentLibConfig.Name,
Description: s.ContentLibConfig.Description,
Flags: s.ContentLibConfig.OvfFlags,
},
Target: vcenter.LibraryTarget{
LibraryID: s.ContentLibConfig.Library,
Expand Down
24 changes: 13 additions & 11 deletions builder/vsphere/common/step_import_to_content_library.hcl2spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Code generated from the comments of the ContentLibraryDestinationConfig struct in builder\vsphere\common\step_import_to_content_library.go; DO NOT EDIT MANUALLY -->
<!-- Code generated from the comments of the ContentLibraryDestinationConfig struct in builder/vsphere/common/step_import_to_content_library.go; DO NOT EDIT MANUALLY -->

- `library` (string) - Name of the library in which the new library item containing the template should be created/updated.
The Content Library should be of type Local to allow deploying virtual machines.
Expand All @@ -13,7 +13,6 @@
item is necessary, use an OVF template instead by setting the [ovf](#ovf) option as `true`.

- `description` (string) - Description of the library item that will be created.
This option is not used when importing OVF templates.
Defaults to "Packer imported [vm_name](#vm_name) VM template".

- `cluster` (string) - Cluster onto which the virtual machine template should be placed.
Expand All @@ -23,7 +22,6 @@
Defaults to [cluster](#cluster).

- `folder` (string) - Virtual machine folder into which the virtual machine template should be placed.
This option is not used when importing OVF templates.
Defaults to the same folder as the source virtual machine.

- `host` (string) - Host onto which the virtual machine template should be placed.
Expand All @@ -47,4 +45,6 @@

- `skip_import` (bool) - When set to true, the VM won't be imported to the content library item. Useful for setting to `true` during a build test stage. Defaults to `false`.

<!-- End of code generated from the comments of the ContentLibraryDestinationConfig struct in builder\vsphere\common\step_import_to_content_library.go; -->
- `ovf_flags` ([]string) - Flags to use for OVF package creation. The supported flags can be obtained using ExportFlag.list. If unset, no flags will be used. Known values: EXTRA_CONFIG, PRESERVE_MAC

<!-- End of code generated from the comments of the ContentLibraryDestinationConfig struct in builder/vsphere/common/step_import_to_content_library.go; -->
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Code generated from the comments of the ContentLibraryDestinationConfig struct in builder\vsphere\common\step_import_to_content_library.go; DO NOT EDIT MANUALLY -->
<!-- Code generated from the comments of the ContentLibraryDestinationConfig struct in builder/vsphere/common/step_import_to_content_library.go; DO NOT EDIT MANUALLY -->

With this configuration Packer creates a library item in a content library whose content is a VM template
or an OVF template created from the just built VM.
The template is stored in a existing or newly created library item.

<!-- End of code generated from the comments of the ContentLibraryDestinationConfig struct in builder\vsphere\common\step_import_to_content_library.go; -->
<!-- End of code generated from the comments of the ContentLibraryDestinationConfig struct in builder/vsphere/common/step_import_to_content_library.go; -->

0 comments on commit 194d805

Please sign in to comment.