builder/*, provisioner/*: set user vars

This commit is contained in:
Mitchell Hashimoto 2013-08-09 14:21:31 -07:00
parent ab5a1981d9
commit 100458955f
8 changed files with 12 additions and 4 deletions

View File

@ -52,6 +52,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
// Defaults
if b.config.ChrootMounts == nil {

View File

@ -45,6 +45,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)

View File

@ -55,6 +55,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
if b.config.BundleDestination == "" {
b.config.BundleDestination = "/tmp"

View File

@ -61,6 +61,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)

View File

@ -70,6 +70,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)

View File

@ -71,6 +71,7 @@ func (b *Builder) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
b.config.tpl.UserVars = b.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)

View File

@ -9,6 +9,8 @@ import (
)
type config struct {
common.PackerConfig `mapstructure:",squash"`
// The local path of the file to upload.
Source string
@ -32,6 +34,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
p.config.tpl.UserVars = p.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)

View File

@ -17,6 +17,8 @@ import (
const DefaultRemotePath = "/tmp/script.sh"
type config struct {
common.PackerConfig `mapstructure:",squash"`
// An inline script to execute. Multiple strings are all executed
// in the context of a single shell.
Inline []string
@ -43,10 +45,6 @@ type config struct {
// can be used to inject the environment_vars into the environment.
ExecuteCommand string `mapstructure:"execute_command"`
// Packer configurations, these come from Packer itself
PackerBuildName string `mapstructure:"packer_build_name"`
PackerBuilderType string `mapstructure:"packer_builder_type"`
tpl *common.Template
}
@ -69,6 +67,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if err != nil {
return err
}
p.config.tpl.UserVars = p.config.PackerUserVars
// Accumulate any errors
errs := common.CheckUnusedConfig(md)