Merge pull request #7903 from devenney/devenney-fixer-housekeeping

Fixer Housekeeping
This commit is contained in:
Megan Marsh 2019-07-24 12:21:06 -07:00 committed by GitHub
commit c4806e2fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 40 deletions

View File

@ -120,46 +120,16 @@ Usage: packer fix [options] TEMPLATE
If the template cannot be fixed due to an error, the command will exit
with a non-zero exit status. Error messages will appear on standard error.
Fixes that are run:
Fixes that are run (in order):
iso-md5 Replaces "iso_md5" in builders with newer
"iso_checksum"
createtime Replaces ".CreateTime" in builder configs with
"{{timestamp}}"
virtualbox-gaattach Updates VirtualBox builders using
"guest_additions_attach" to use
"guest_additions_mode"
pp-vagrant-override Replaces old-style provider overrides for the
Vagrant post-processor to new-style as of Packer
0.5.0.
virtualbox-rename Updates "virtualbox" builders to "virtualbox-iso"
vmware-rename Updates "vmware" builders to "vmware-iso"
parallels-headless Removes unused "headless" setting from Parallels
builders
parallels-deprecations Removes deprecated "parallels_tools_host_path" from
Parallels builders
sshkeypath Updates builders using "ssh_key_path" to use
"ssh_private_key_file"
sshdisableagent Updates builders using "ssh_disable_agent" to use
"ssh_disable_agent_forwarding"
manifest-filename Updates "manifest" post-processor so any "filename"
field is renamed to "output"
amazon-shutdown_behavior Changes "shutdown_behaviour" to "shutdown_behavior"
in Amazon builders
amazon-enhanced-networking Replaces "enhanced_networking" in builders with
"ena_support"
amazon-private-ip Replaces "ssh_private_ip": true in amazon builders
with "ssh_interface": "private_ip"
docker-email Removes "login_email" from the Docker builder
powershell-escapes Removes PowerShell escapes from user env vars and
elevated username and password strings
hyperv-deprecations Removes the deprecated "vhd_temp_path" setting from
Hyper-V ISO builder templates
hyperv-vmxc-typo Corrects a typo in the "clone_from_vmxc_path"
setting. Replaces with "clone_from_vmcx_path".
vmware-compaction Adds "skip_compaction = true" to "vmware-iso"
builders with incompatible disk_type_id
`
for _, name := range fix.FixerOrder {
helpText += fmt.Sprintf(
" %-27s%s\n", name, fix.Fixers[name].Synopsis())
}
helpText += `
Options:
-validate=true If true (default), validates the fixed template.

View File

@ -66,6 +66,8 @@ func init() {
"docker-email",
"powershell-escapes",
"vmware-compaction",
"hyperv-deprecations",
"hyperv-vmxc-typo",
"hyperv-cpu-and-ram",
"clean-image-name",
"spot-price-auto-product",

View File

@ -54,6 +54,5 @@ func (FixerParallelsDeprecations) Fix(input map[string]interface{}) (map[string]
}
func (FixerParallelsDeprecations) Synopsis() string {
return `Removes deprecated "parallels_tools_host_path" from Parallels builders
and changes "guest_os_distribution" to "guest_os_type".`
return `Removes deprecated "parallels_tools_host_path" from Parallels builders and changes "guest_os_distribution" to "guest_os_type".`
}

29
fix/fixer_test.go Normal file
View File

@ -0,0 +1,29 @@
package fix
import (
"testing"
)
func TestFix_allFixersEnabled(t *testing.T) {
f := Fixers
o := FixerOrder
if len(f) != len(o) {
t.Fatalf("Fixers length (%d) does not match FixerOrder length (%d)", len(f), len(o))
}
for fixer, _ := range f {
found := false
for _, orderedFixer := range o {
if orderedFixer == fixer {
found = true
break
}
}
if !found {
t.Fatalf("Did not find Fixer %s in FixerOrder", fixer)
}
}
}