command/fix: use strings instead of Fixer for list

This commit is contained in:
Mitchell Hashimoto 2013-08-08 17:11:39 -07:00
parent 23803621e9
commit bdd49619ae
1 changed files with 10 additions and 2 deletions

View File

@ -49,10 +49,18 @@ func (c Command) Run(env packer.Environment, args []string) int {
tplF.Close()
// Run the template through the various fixers
fixers := []Fixer{Fixers["iso-md5"]}
fixers := []string{
"iso-md5",
}
input := templateData
for _, fixer := range fixers {
for _, name := range fixers {
var err error
fixer, ok := Fixers[name]
if !ok {
panic("fixer not found: " + name)
}
input, err = fixer.Fix(input)
if err != nil {
env.Ui().Error(fmt.Sprintf("Error fixing: %s", err))