Skip to content

Commit

Permalink
Add http_content func to serve variables from HTTP @ preseed (#10801)
Browse files Browse the repository at this point in the history
This imports hashicorp/packer-plugin-sdk#43

* code generate things
* update docs
* update guides
* update examples

We want to add a new guide.
  • Loading branch information
azr authored Mar 23, 2021
1 parent 0fa61b2 commit 492863d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
7 changes: 1 addition & 6 deletions builder/parallels/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Directories: b.config.FloppyConfig.FloppyDirectories,
Label: b.config.FloppyConfig.FloppyLabel,
},
&commonsteps.StepHTTPServer{
HTTPDir: b.config.HTTPDir,
HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax,
HTTPAddress: b.config.HTTPAddress,
},
commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig),
new(stepCreateVM),
new(stepCreateDisk),
new(stepSetBootOrder),
Expand Down
2 changes: 2 additions & 0 deletions builder/parallels/iso/builder.hcl2spec.go

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

7 changes: 1 addition & 6 deletions builder/virtualbox/iso/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,12 +406,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Label: b.config.CDConfig.CDLabel,
},
new(vboxcommon.StepHTTPIPDiscover),
&commonsteps.StepHTTPServer{
HTTPDir: b.config.HTTPDir,
HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax,
HTTPAddress: b.config.HTTPAddress,
},
commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig),
&vboxcommon.StepSshKeyPair{
Debug: b.config.PackerDebug,
DebugKeyPath: fmt.Sprintf("%s.pem", b.config.PackerBuildName),
Expand Down
7 changes: 1 addition & 6 deletions builder/virtualbox/ovf/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Label: b.config.CDConfig.CDLabel,
},
new(vboxcommon.StepHTTPIPDiscover),
&commonsteps.StepHTTPServer{
HTTPDir: b.config.HTTPDir,
HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax,
HTTPAddress: b.config.HTTPAddress,
},
commonsteps.HTTPServerFromHTTPConfig(&b.config.HTTPConfig),
&vboxcommon.StepSshKeyPair{
Debug: b.config.PackerDebug,
DebugKeyPath: fmt.Sprintf("%s.pem", b.config.PackerBuildName),
Expand Down
22 changes: 8 additions & 14 deletions website/content/docs/builders/parallels/iso.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,6 @@ can also be supplied to override the typical auto-generated key:
\["en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7", "en8", "en9",
"ppp0", "ppp1", "ppp2"\].

- `http_directory` (string) - Path to a directory to serve using an
HTTP server. The files in this directory will be available over HTTP that
will be requestable from the virtual machine. This is useful for hosting
kickstart files and so on. By default this is "", which means no HTTP server
will be started. The address and port of the HTTP server will be available
as variables in `boot_command`. This is covered in more detail below.

- `http_port_min` and `http_port_max` (number) - These are the minimum and
maximum port to use for the HTTP server started to serve the
`http_directory`. Because Packer often runs in parallel, Packer will choose
a randomly available port in this range to run the HTTP server. If you want
to force the HTTP server to be on one port, make this minimum and maximum
port the same. By default the values are 8000 and 9000, respectively.

- `memory` (number) - The amount of memory to use for building the VM in
megabytes. Defaults to `512` megabytes.

Expand Down Expand Up @@ -231,6 +217,14 @@ can also be supplied to override the typical auto-generated key:
virtual machine, without the file extension. By default this is
"packer-BUILDNAME", where "BUILDNAME" is the name of the build.

## Http directory configuration reference

@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig.mdx'

### Optional:

@include 'packer-plugin-sdk/multistep/commonsteps/HTTPConfig-not-required.mdx'

## Boot Command

The `boot_command` configuration is very important: it specifies the keys to
Expand Down

0 comments on commit 492863d

Please sign in to comment.