Commit 332bdf6e authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/*, provisioner/*: set user vars

parent 670c6c5c
......@@ -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 {
......
......@@ -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)
......
......@@ -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"
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
......
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