fix boot command config struct name
This commit is contained in:
parent
e662927623
commit
7990966a09
|
@ -27,7 +27,7 @@ type Config struct {
|
|||
common.HTTPConfig `mapstructure:",squash"`
|
||||
common.ISOConfig `mapstructure:",squash"`
|
||||
common.FloppyConfig `mapstructure:",squash"`
|
||||
bootcommand.Config `mapstructure:",squash"`
|
||||
bootcommand.BootConfig `mapstructure:",squash"`
|
||||
parallelscommon.OutputConfig `mapstructure:",squash"`
|
||||
parallelscommon.PrlctlConfig `mapstructure:",squash"`
|
||||
parallelscommon.PrlctlPostConfig `mapstructure:",squash"`
|
||||
|
@ -82,7 +82,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|||
errs = packer.MultiErrorAppend(errs, b.config.ShutdownConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.SSHConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.ToolsConfig.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.Config.Prepare(&b.config.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, b.config.BootConfig.Prepare(&b.config.ctx)...)
|
||||
|
||||
if b.config.DiskSize == 0 {
|
||||
b.config.DiskSize = 40000
|
||||
|
|
|
@ -22,7 +22,7 @@ type Config struct {
|
|||
parallelscommon.PrlctlVersionConfig `mapstructure:",squash"`
|
||||
parallelscommon.SSHConfig `mapstructure:",squash"`
|
||||
parallelscommon.ShutdownConfig `mapstructure:",squash"`
|
||||
bootcommand.Config `mapstructure:",squash"`
|
||||
bootcommand.BootConfig `mapstructure:",squash"`
|
||||
parallelscommon.ToolsConfig `mapstructure:",squash"`
|
||||
|
||||
SourcePath string `mapstructure:"source_path"`
|
||||
|
@ -61,7 +61,7 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
errs = packer.MultiErrorAppend(errs, c.PrlctlConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.PrlctlPostConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.PrlctlVersionConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.Config.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.BootConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.ShutdownConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.SSHConfig.Prepare(&c.ctx)...)
|
||||
errs = packer.MultiErrorAppend(errs, c.ToolsConfig.Prepare(&c.ctx)...)
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/hashicorp/packer/template/interpolate"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
type BootConfig struct {
|
||||
RawBootWait string `mapstructure:"boot_wait"`
|
||||
BootCommand []string `mapstructure:"boot_command"`
|
||||
|
||||
|
@ -16,11 +16,11 @@ type Config struct {
|
|||
}
|
||||
|
||||
type VNCConfig struct {
|
||||
Config
|
||||
BootConfig
|
||||
DisableVNC bool `mapstructure:"disable_vnc"`
|
||||
}
|
||||
|
||||
func (c *Config) Prepare(ctx *interpolate.Context) (errs []error) {
|
||||
func (c *BootConfig) Prepare(ctx *interpolate.Context) (errs []error) {
|
||||
if c.RawBootWait == "" {
|
||||
c.RawBootWait = "10s"
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ func (c *Config) Prepare(ctx *interpolate.Context) (errs []error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (c *Config) FlatBootCommand() string {
|
||||
func (c *BootConfig) FlatBootCommand() string {
|
||||
return strings.Join(c.BootCommand, "")
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,6 @@ func (c *VNCConfig) Prepare(ctx *interpolate.Context) (errs []error) {
|
|||
errs = append(errs,
|
||||
fmt.Errorf("A boot command cannot be used when vnc is disabled."))
|
||||
}
|
||||
errs = append(errs, c.Config.Prepare(ctx)...)
|
||||
errs = append(errs, c.BootConfig.Prepare(ctx)...)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
)
|
||||
|
||||
func TestConfigPrepare(t *testing.T) {
|
||||
var c *Config
|
||||
var c *BootConfig
|
||||
|
||||
// Test a default boot_wait
|
||||
c = new(Config)
|
||||
c = new(BootConfig)
|
||||
c.RawBootWait = ""
|
||||
errs := c.Prepare(&interpolate.Context{})
|
||||
if len(errs) > 0 {
|
||||
|
@ -21,7 +21,7 @@ func TestConfigPrepare(t *testing.T) {
|
|||
}
|
||||
|
||||
// Test with a bad boot_wait
|
||||
c = new(Config)
|
||||
c = new(BootConfig)
|
||||
c.RawBootWait = "this is not good"
|
||||
errs = c.Prepare(&interpolate.Context{})
|
||||
if len(errs) == 0 {
|
||||
|
@ -29,7 +29,7 @@ func TestConfigPrepare(t *testing.T) {
|
|||
}
|
||||
|
||||
// Test with a good one
|
||||
c = new(Config)
|
||||
c = new(BootConfig)
|
||||
c.RawBootWait = "5s"
|
||||
errs = c.Prepare(&interpolate.Context{})
|
||||
if len(errs) > 0 {
|
||||
|
|
Loading…
Reference in New Issue