From 5dec2ddb9c7068493250713131e3496c0c5dae16 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 26 Apr 2014 14:23:22 -0700 Subject: [PATCH] common: weakly decode the PackerConfig --- common/config.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/config.go b/common/config.go index 3f072f825..0919bf714 100644 --- a/common/config.go +++ b/common/config.go @@ -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 } }