packer-cn/fix/fixer.go
James Bishopp 51b2069af1 Added fixer for ssh_key_path
- ssh_key_path is removed in all cases.
- The new fixer is not checking the builder type so it will execute for all
  builders.
- If ssh_key_path exists without ssh_private_key_file then it will assign
  the value of ssh_path_path to ssh_private_key_file
- If ssh_private_key_file and ssh_key_path exist, then ssh_key_path is
  simply removed

I wanted to emit a warning messsage to the user but it didn't seem like
the ui.* interface was exposed to fixers.
2016-02-12 17:24:42 -08:00

46 lines
1.3 KiB
Go

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)
// Synopsis returns a string description of what the fixer actually
// does.
Synopsis() string
}
// 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),
"pp-vagrant-override": new(FixerVagrantPPOverride),
"virtualbox-gaattach": new(FixerVirtualBoxGAAttach),
"virtualbox-rename": new(FixerVirtualBoxRename),
"vmware-rename": new(FixerVMwareRename),
"parallels-headless": new(FixerParallelsHeadless),
"parallels-deprecations": new(FixerParallelsDeprecations),
"sshkeypath": new(FixerSSHKeyPath),
}
FixerOrder = []string{
"iso-md5",
"createtime",
"virtualbox-gaattach",
"pp-vagrant-override",
"virtualbox-rename",
"vmware-rename",
"parallels-headless",
"parallels-deprecations",
"sshkeypath",
}
}