Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support floppy_content parameter #117

Merged
merged 3 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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