Merge pull request #9489 from ad-m/hyperone-freebsd
builder/hyperone: Allow skip chroot device discovery
This commit is contained in:
commit
445cf12b65
|
@ -100,6 +100,7 @@ type Config struct {
|
||||||
// Can be useful when using custom api_url. Defaults to public.
|
// Can be useful when using custom api_url. Defaults to public.
|
||||||
PublicNetAdpService string `mapstructure:"public_netadp_service" required:"false"`
|
PublicNetAdpService string `mapstructure:"public_netadp_service" required:"false"`
|
||||||
|
|
||||||
|
ChrootDevice string `mapstructure:"chroot_device"`
|
||||||
ChrootDisk bool `mapstructure:"chroot_disk"`
|
ChrootDisk bool `mapstructure:"chroot_disk"`
|
||||||
ChrootDiskSize float32 `mapstructure:"chroot_disk_size"`
|
ChrootDiskSize float32 `mapstructure:"chroot_disk_size"`
|
||||||
ChrootDiskType string `mapstructure:"chroot_disk_type"`
|
ChrootDiskType string `mapstructure:"chroot_disk_type"`
|
||||||
|
|
|
@ -83,6 +83,7 @@ type FlatConfig struct {
|
||||||
PrivateIP *string `mapstructure:"private_ip" required:"false" cty:"private_ip" hcl:"private_ip"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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"`
|
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},
|
"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_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},
|
"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": &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_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},
|
"chroot_disk_type": &hcldec.AttrSpec{Name: "chroot_disk_type", Type: cty.String, Required: false},
|
||||||
|
|
|
@ -17,6 +17,13 @@ type stepPrepareDevice struct{}
|
||||||
|
|
||||||
func (s *stepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
func (s *stepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||||
ui := state.Get("ui").(packer.Ui)
|
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)
|
controllerNumber := state.Get("chroot_controller_number").(string)
|
||||||
controllerLocation := state.Get("chroot_controller_location").(int)
|
controllerLocation := state.Get("chroot_controller_location").(int)
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,9 @@ builder.
|
||||||
that will be copied into the chroot environment before provisioning.
|
that will be copied into the chroot environment before provisioning.
|
||||||
Defaults to `/etc/resolv.conf` so that DNS lookups work.
|
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
|
- `chroot_disk_size` (float) - The size of the chroot disk in GiB. Defaults
|
||||||
to `disk_size`.
|
to `disk_size`.
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
- `public_netadp_service` (string) - Custom service of public network adapter.
|
- `public_netadp_service` (string) - Custom service of public network adapter.
|
||||||
Can be useful when using custom api_url. Defaults to public.
|
Can be useful when using custom api_url. Defaults to public.
|
||||||
|
|
||||||
|
- `chroot_device` (string) - Chroot Device
|
||||||
- `chroot_disk` (bool) - Chroot Disk
|
- `chroot_disk` (bool) - Chroot Disk
|
||||||
- `chroot_disk_size` (float32) - Chroot Disk Size
|
- `chroot_disk_size` (float32) - Chroot Disk Size
|
||||||
- `chroot_disk_type` (string) - Chroot Disk Type
|
- `chroot_disk_type` (string) - Chroot Disk Type
|
||||||
|
|
Loading…
Reference in New Issue