Commit 877dfb81 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

common: Allow user variables to be used for ints/bools/etc. [GH-418]

parent aa694072
...@@ -8,6 +8,8 @@ FEATURES: ...@@ -8,6 +8,8 @@ FEATURES:
IMPROVEMENTS: IMPROVEMENTS:
* core: User variables can now be used for integer, boolean, etc.
values. [GH-418]
* builder/amazon/all: Interrupts work while waiting for AMI to be ready. * builder/amazon/all: Interrupts work while waiting for AMI to be ready.
BUG FIXES: BUG FIXES:
......
...@@ -41,8 +41,9 @@ func CheckUnusedConfig(md *mapstructure.Metadata) *packer.MultiError { ...@@ -41,8 +41,9 @@ func CheckUnusedConfig(md *mapstructure.Metadata) *packer.MultiError {
func DecodeConfig(target interface{}, raws ...interface{}) (*mapstructure.Metadata, error) { func DecodeConfig(target interface{}, raws ...interface{}) (*mapstructure.Metadata, error) {
var md mapstructure.Metadata var md mapstructure.Metadata
decoderConfig := &mapstructure.DecoderConfig{ decoderConfig := &mapstructure.DecoderConfig{
Metadata: &md, Metadata: &md,
Result: target, Result: target,
WeaklyTypedInput: true,
} }
decoder, err := mapstructure.NewDecoder(decoderConfig) decoder, err := mapstructure.NewDecoder(decoderConfig)
......
...@@ -54,7 +54,7 @@ validation will fail. ...@@ -54,7 +54,7 @@ validation will fail.
Using the variables is extremely easy. Variables are used by calling Using the variables is extremely easy. Variables are used by calling
the user function in the form of <code>{{user &#96;variable&#96;}}</code>. the user function in the form of <code>{{user &#96;variable&#96;}}</code>.
This function can be used in _any string_ within the template, in This function can be used in _any value_ within the template, in
builders, provisioners, _anything_. The user variable is available globally builders, provisioners, _anything_. The user variable is available globally
within the template. within the template.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment