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

This commit is contained in:
Mitchell Hashimoto 2013-09-18 16:18:39 -07:00
parent bda4754e68
commit cfe3eee547
3 changed files with 6 additions and 3 deletions

View File

@ -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:

View File

@ -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)

View File

@ -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.