Merge pull request #9489 from ad-m/hyperone-freebsd

builder/hyperone: Allow skip chroot device discovery
This commit is contained in:
Megan Marsh 2020-07-01 15:48:03 -07:00 committed by GitHub
commit 445cf12b65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 0 deletions

View File

@ -100,6 +100,7 @@ type Config struct {
// Can be useful when using custom api_url. Defaults to public.
PublicNetAdpService string `mapstructure:"public_netadp_service" required:"false"`
ChrootDevice string `mapstructure:"chroot_device"`
ChrootDisk bool `mapstructure:"chroot_disk"`
ChrootDiskSize float32 `mapstructure:"chroot_disk_size"`
ChrootDiskType string `mapstructure:"chroot_disk_type"`

View File

@ -83,6 +83,7 @@ type FlatConfig struct {
PrivateIP *string `mapstructure:"private_ip" required:"false" cty:"private_ip" hcl:"private_ip"`
PublicIP *string `mapstructure:"public_ip" required:"false" cty:"public_ip" hcl:"public_ip"`
PublicNetAdpService *string `mapstructure:"public_netadp_service" required:"false" cty:"public_netadp_service" hcl:"public_netadp_service"`
ChrootDevice *string `mapstructure:"chroot_device" cty:"chroot_device" hcl:"chroot_device"`
ChrootDisk *bool `mapstructure:"chroot_disk" cty:"chroot_disk" hcl:"chroot_disk"`
ChrootDiskSize *float32 `mapstructure:"chroot_disk_size" cty:"chroot_disk_size" hcl:"chroot_disk_size"`
ChrootDiskType *string `mapstructure:"chroot_disk_type" cty:"chroot_disk_type" hcl:"chroot_disk_type"`
@ -183,6 +184,7 @@ func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec {
"private_ip": &hcldec.AttrSpec{Name: "private_ip", Type: cty.String, Required: false},
"public_ip": &hcldec.AttrSpec{Name: "public_ip", Type: cty.String, Required: false},
"public_netadp_service": &hcldec.AttrSpec{Name: "public_netadp_service", Type: cty.String, Required: false},
"chroot_device": &hcldec.AttrSpec{Name: "chroot_device", Type: cty.String, Required: false},
"chroot_disk": &hcldec.AttrSpec{Name: "chroot_disk", Type: cty.Bool, Required: false},
"chroot_disk_size": &hcldec.AttrSpec{Name: "chroot_disk_size", Type: cty.Number, Required: false},
"chroot_disk_type": &hcldec.AttrSpec{Name: "chroot_disk_type", Type: cty.String, Required: false},

View File

@ -17,6 +17,13 @@ type stepPrepareDevice struct{}
func (s *stepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packer.Ui)
config := state.Get("config").(*Config)
if config.ChrootDevice != "" {
state.Put("device", config.ChrootDevice)
return multistep.ActionContinue
}
controllerNumber := state.Get("chroot_controller_number").(string)
controllerLocation := state.Get("chroot_controller_location").(int)

View File

@ -181,6 +181,9 @@ builder.
that will be copied into the chroot environment before provisioning.
Defaults to `/etc/resolv.conf` so that DNS lookups work.
- `chroot_device` (string) - The path of chroot device. Defaults an attempt is
made to identify it based on the attach location.
- `chroot_disk_size` (float) - The size of the chroot disk in GiB. Defaults
to `disk_size`.

View File

@ -49,6 +49,7 @@
- `public_netadp_service` (string) - Custom service of public network adapter.
Can be useful when using custom api_url. Defaults to public.
- `chroot_device` (string) - Chroot Device
- `chroot_disk` (bool) - Chroot Disk
- `chroot_disk_size` (float32) - Chroot Disk Size
- `chroot_disk_type` (string) - Chroot Disk Type