Fix config loading

This commit is contained in:
flx5 2021-10-03 20:54:12 +02:00
parent 3c3024fd92
commit 73b9acc9cc
3 changed files with 5 additions and 4 deletions

View File

@ -171,8 +171,9 @@ func (c *CommonConfig) Prepare(upper interface{}, raws ...interface{}) ([]string
// Validation
if c.HTTPPortMin > c.HTTPPortMax {
errs = packersdk.MultiErrorAppend(errs, errors.New("the HTTP min port must be less than the max"))
// Lower bound is not checked in commonsteps.HTTPConfig
if c.HTTPPortMin < 0 {
errs = packersdk.MultiErrorAppend(errs, errors.New("the HTTP min port must greater than zero"))
}
switch c.Format {

View File

@ -70,7 +70,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, []string, error) {
var errs *packersdk.MultiError
params, warnings, merrs := c.CommonConfig.Prepare(c, raws)
params, warnings, merrs := c.CommonConfig.Prepare(c, raws...)
if merrs != nil {
errs = packersdk.MultiErrorAppend(errs, merrs)
}

View File

@ -17,7 +17,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, []string, error) {
var errs *packersdk.MultiError
params, warnings, merrs := c.CommonConfig.Prepare(c, raws)
params, warnings, merrs := c.CommonConfig.Prepare(c, raws...)
if merrs != nil {
errs = packersdk.MultiErrorAppend(errs, merrs)
}