2013-07-14 03:51:20 -04:00
|
|
|
package fix
|
|
|
|
|
|
|
|
// A Fixer is something that can perform a fix operation on a template.
|
|
|
|
type Fixer interface {
|
|
|
|
// Fix takes a raw map structure input, potentially transforms it
|
|
|
|
// in some way, and returns the new, transformed structure. The
|
|
|
|
// Fix method is allowed to mutate the input.
|
|
|
|
Fix(input map[string]interface{}) (map[string]interface{}, error)
|
2013-11-02 04:49:00 -04:00
|
|
|
|
|
|
|
// Synopsis returns a string description of what the fixer actually
|
|
|
|
// does.
|
|
|
|
Synopsis() string
|
2013-07-14 03:51:20 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fixers is the map of all available fixers, by name.
|
|
|
|
var Fixers map[string]Fixer
|
|
|
|
|
2013-12-19 17:44:12 -05:00
|
|
|
// FixerOrder is the default order the fixers should be run.
|
|
|
|
var FixerOrder []string
|
|
|
|
|
2013-07-14 03:51:20 -04:00
|
|
|
func init() {
|
|
|
|
Fixers = map[string]Fixer{
|
2013-11-02 04:43:57 -04:00
|
|
|
"iso-md5": new(FixerISOMD5),
|
|
|
|
"createtime": new(FixerCreateTime),
|
2013-12-19 17:54:00 -05:00
|
|
|
"pp-vagrant-override": new(FixerVagrantPPOverride),
|
2013-11-02 04:43:57 -04:00
|
|
|
"virtualbox-gaattach": new(FixerVirtualBoxGAAttach),
|
2013-12-22 19:01:28 -05:00
|
|
|
"virtualbox-rename": new(FixerVirtualBoxRename),
|
2013-12-25 13:13:32 -05:00
|
|
|
"vmware-rename": new(FixerVMwareRename),
|
2013-07-14 03:51:20 -04:00
|
|
|
}
|
2013-12-19 17:44:12 -05:00
|
|
|
|
|
|
|
FixerOrder = []string{
|
|
|
|
"iso-md5",
|
|
|
|
"createtime",
|
|
|
|
"virtualbox-gaattach",
|
2013-12-19 17:54:00 -05:00
|
|
|
"pp-vagrant-override",
|
2013-12-22 19:01:28 -05:00
|
|
|
"virtualbox-rename",
|
2013-12-25 13:13:32 -05:00
|
|
|
"vmware-rename",
|
2013-12-19 17:44:12 -05:00
|
|
|
}
|
2013-07-14 03:51:20 -04:00
|
|
|
}
|