Skip to content

Commit

Permalink
Support floppy_content parameter (#117)
Browse files Browse the repository at this point in the history
* Support floppy_content
* Update packer-plugin-sdk to v0.2.7

Signed-off-by: Stéphane Este-Gracias <[email protected]>
  • Loading branch information
sestegra authored Oct 11, 2021
1 parent 993cf57 commit bbb1db3
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 4 deletions.
1 change: 1 addition & 0 deletions builder/vsphere/clone/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
&commonsteps.StepCreateFloppy{
Files: b.config.FloppyFiles,
Directories: b.config.FloppyDirectories,
Content: b.config.FloppyContent,
Label: b.config.FloppyLabel,
},
&common.StepAddFloppy{
Expand Down
2 changes: 2 additions & 0 deletions builder/vsphere/clone/config.hcl2spec.go

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

15 changes: 15 additions & 0 deletions builder/vsphere/common/step_add_floppy.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ type FloppyConfig struct {
FloppyFiles []string `mapstructure:"floppy_files"`
// List of directories to copy files from.
FloppyDirectories []string `mapstructure:"floppy_dirs"`
// Key/Values to add to the floppy disk. The keys represent the paths, and
// the values contents. It can be used alongside `floppy_files` or
// `floppy_dirs`, which is useful to add large files without loading them
// into memory. If any paths are specified by both, the contents in
// `floppy_content` will take precedence.
//
// Usage example (HCL):
//
// ```hcl
// floppy_content = {
// "meta-data" = jsonencode(local.instance_data)
// "user-data" = templatefile("user-data", { packages = ["nginx"] })
// }
// ```
FloppyContent map[string]string `mapstructure:"floppy_content"`
// The label to use for the floppy disk that
// is attached when the VM is booted. This is most useful for cloud-init,
// Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
Expand Down
10 changes: 6 additions & 4 deletions builder/vsphere/common/step_add_floppy.hcl2spec.go

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

1 change: 1 addition & 0 deletions builder/vsphere/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
&commonsteps.StepCreateFloppy{
Files: b.config.FloppyFiles,
Directories: b.config.FloppyDirectories,
Content: b.config.FloppyContent,
Label: b.config.FloppyLabel,
},
&common.StepAddFloppy{
Expand Down
2 changes: 2 additions & 0 deletions builder/vsphere/iso/config.hcl2spec.go

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

15 changes: 15 additions & 0 deletions docs-partials/builder/vsphere/common/FloppyConfig-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@

- `floppy_dirs` ([]string) - List of directories to copy files from.

- `floppy_content` (map[string]string) - Key/Values to add to the floppy disk. The keys represent the paths, and
the values contents. It can be used alongside `floppy_files` or
`floppy_dirs`, which is useful to add large files without loading them
into memory. If any paths are specified by both, the contents in
`floppy_content` will take precedence.

Usage example (HCL):

```hcl
floppy_content = {
"meta-data" = jsonencode(local.instance_data)
"user-data" = templatefile("user-data", { packages = ["nginx"] })
}
```

- `floppy_label` (string) - The label to use for the floppy disk that
is attached when the VM is booted. This is most useful for cloud-init,
Kickstart or other early initialization tools, which can benefit from labelled floppy disks.
Expand Down

0 comments on commit bbb1db3

Please sign in to comment.