common: Allow user variables to be used for ints/bools/etc. [GH-418]
This commit is contained in:
parent
bda4754e68
commit
cfe3eee547
|
@ -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 {
|
||||||
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.
|
||||||
|
|
||||||
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 `variable`}}</code>.
|
the user function in the form of <code>{{user `variable`}}</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.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue