From 7990966a0921d7610e7b28f988db2eecd58b890f Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Wed, 18 Apr 2018 14:20:34 -0700 Subject: [PATCH] fix boot command config struct name --- builder/parallels/iso/builder.go | 4 ++-- builder/parallels/pvm/config.go | 4 ++-- common/boot_command/config.go | 10 +++++----- common/boot_command/config_test.go | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/builder/parallels/iso/builder.go b/builder/parallels/iso/builder.go index 0bb8b4209..85d1199e6 100644 --- a/builder/parallels/iso/builder.go +++ b/builder/parallels/iso/builder.go @@ -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 diff --git a/builder/parallels/pvm/config.go b/builder/parallels/pvm/config.go index 0ece6e11e..8d34f24b5 100644 --- a/builder/parallels/pvm/config.go +++ b/builder/parallels/pvm/config.go @@ -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)...) diff --git a/common/boot_command/config.go b/common/boot_command/config.go index 6a5b18cd9..058efc2ed 100644 --- a/common/boot_command/config.go +++ b/common/boot_command/config.go @@ -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 } diff --git a/common/boot_command/config_test.go b/common/boot_command/config_test.go index 608e48c0a..551f2c785 100644 --- a/common/boot_command/config_test.go +++ b/common/boot_command/config_test.go @@ -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 {