From 84f8c0bfa0938c32cbb63029bfbfdd3acf6d99f6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 19 Dec 2013 14:44:12 -0800 Subject: [PATCH] command/fix: cleaner --- command/fix/command.go | 9 +-------- command/fix/fixer.go | 9 +++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/command/fix/command.go b/command/fix/command.go index 5de003cea..c62d3676b 100644 --- a/command/fix/command.go +++ b/command/fix/command.go @@ -49,15 +49,8 @@ func (c Command) Run(env packer.Environment, args []string) int { // Close the file since we're done with that tplF.Close() - // Run the template through the various fixers - fixers := []string{ - "iso-md5", - "createtime", - "virtualbox-gaattach", - } - input := templateData - for _, name := range fixers { + for _, name := range FixerOrder { var err error fixer, ok := Fixers[name] if !ok { diff --git a/command/fix/fixer.go b/command/fix/fixer.go index fca464c5a..f82cc9393 100644 --- a/command/fix/fixer.go +++ b/command/fix/fixer.go @@ -15,10 +15,19 @@ type Fixer interface { // Fixers is the map of all available fixers, by name. var Fixers map[string]Fixer +// FixerOrder is the default order the fixers should be run. +var FixerOrder []string + func init() { Fixers = map[string]Fixer{ "iso-md5": new(FixerISOMD5), "createtime": new(FixerCreateTime), "virtualbox-gaattach": new(FixerVirtualBoxGAAttach), } + + FixerOrder = []string{ + "iso-md5", + "createtime", + "virtualbox-gaattach", + } }