From 75d8d7fce5e2c1fe3120008c23e0b236c9c9c275 Mon Sep 17 00:00:00 2001 From: Brendan Devenney Date: Wed, 24 Jul 2019 17:18:07 +0100 Subject: [PATCH] Update and futureproof fix command usage * Dynamically generate the fixer documentation (in order) from FixerOrder * Update fixers which used linebreaks in their Synopsis Signed-off-by: Brendan Devenney --- command/fix.go | 46 +++++------------------------ fix/fixer_parallels_deprecations.go | 3 +- 2 files changed, 9 insertions(+), 40 deletions(-) diff --git a/command/fix.go b/command/fix.go index 227edc403..6185b2954 100644 --- a/command/fix.go +++ b/command/fix.go @@ -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( + "\t%-30s\t%s\n",name, fix.Fixers[name].Synopsis()) + } + + helpText += ` Options: -validate=true If true (default), validates the fixed template. diff --git a/fix/fixer_parallels_deprecations.go b/fix/fixer_parallels_deprecations.go index 9aff731ad..9afc22088 100644 --- a/fix/fixer_parallels_deprecations.go +++ b/fix/fixer_parallels_deprecations.go @@ -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".` }