command/fix: cleaner

This commit is contained in:
Mitchell Hashimoto 2013-12-19 14:44:12 -08:00
parent b6795081b8
commit 84f8c0bfa0
2 changed files with 10 additions and 8 deletions

View File

@ -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 {

View File

@ -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",
}
}