common: weakly decode the PackerConfig
This commit is contained in:
parent
ce7ea006c7
commit
5dec2ddb9c
|
@ -191,8 +191,17 @@ func decodeConfigHook(raws []interface{}) (mapstructure.DecodeHookFunc, error) {
|
|||
// First thing we do is decode PackerConfig so that we can have access
|
||||
// to the user variables so that we can process some templates.
|
||||
var pc PackerConfig
|
||||
|
||||
decoderConfig := &mapstructure.DecoderConfig{
|
||||
Result: &pc,
|
||||
WeaklyTypedInput: true,
|
||||
}
|
||||
decoder, err := mapstructure.NewDecoder(decoderConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, raw := range raws {
|
||||
if err := mapstructure.Decode(raw, &pc); err != nil {
|
||||
if err := decoder.Decode(raw); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue