This commit is contained in:
Mitchell Hashimoto 2013-05-07 13:40:49 -07:00
parent 04563764a0
commit f601625f7b
1 changed files with 16 additions and 2 deletions

View File

@ -10,10 +10,24 @@ import (
) )
func main() { func main() {
commands := map[string]string {
"build": "packer-build",
}
commandKeys := make([]string, 0, len(commands))
for k, _ := range commands {
commandKeys = append(commandKeys, k)
}
envConfig := packer.DefaultEnvironmentConfig() envConfig := packer.DefaultEnvironmentConfig()
envConfig.Commands = []string{"build"} envConfig.Commands = commandKeys
envConfig.CommandFunc = func(n string) packer.Command { envConfig.CommandFunc = func(n string) packer.Command {
return plugin.Command(exec.Command("bin/packer-build")) commandBin, ok := commands[n]
if !ok {
return nil
}
return plugin.Command(exec.Command(commandBin))
} }
env, err := packer.NewEnvironment(envConfig) env, err := packer.NewEnvironment(envConfig)