github.com/hashicorp/packer@v1.14.3/fix/fixer.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: BUSL-1.1
     3  
     4  package fix
     5  
     6  // A Fixer is something that can perform a fix operation on a template.
     7  type Fixer interface {
     8  	// DeprecatedOptions returns the name(s) of the option(s) being replaced in
     9  	// this fixer. It is used to generate a list of deprecated options that the
    10  	// template parser checks against to warn users that they need to call
    11  	// `packer fix` against their templates after upgrading.
    12  	DeprecatedOptions() map[string][]string
    13  
    14  	// Fix takes a raw map structure input, potentially transforms it
    15  	// in some way, and returns the new, transformed structure. The
    16  	// Fix method is allowed to mutate the input.
    17  	Fix(input map[string]interface{}) (map[string]interface{}, error)
    18  
    19  	// Synopsis returns a string description of what the fixer actually
    20  	// does.
    21  	Synopsis() string
    22  }
    23  
    24  // Fixers is the map of all available fixers, by name.
    25  var Fixers map[string]Fixer
    26  
    27  // FixerOrder is the default order the fixers should be run.
    28  var FixerOrder []string
    29  
    30  func init() {
    31  	Fixers = map[string]Fixer{
    32  		"iso-md5":                    new(FixerISOMD5),
    33  		"createtime":                 new(FixerCreateTime),
    34  		"pp-vagrant-override":        new(FixerVagrantPPOverride),
    35  		"virtualbox-gaattach":        new(FixerVirtualBoxGAAttach),
    36  		"virtualbox-rename":          new(FixerVirtualBoxRename),
    37  		"vmware-rename":              new(FixerVMwareRename),
    38  		"parallels-headless":         new(FixerParallelsHeadless),
    39  		"parallels-deprecations":     new(FixerParallelsDeprecations),
    40  		"sshkeypath":                 new(FixerSSHKeyPath),
    41  		"sshdisableagent":            new(FixerSSHDisableAgent),
    42  		"scaleway-access-key":        new(FixerScalewayAccessKey),
    43  		"manifest-filename":          new(FixerManifestFilename),
    44  		"amazon-shutdown_behavior":   new(FixerAmazonShutdownBehavior),
    45  		"amazon-enhanced-networking": new(FixerAmazonEnhancedNetworking),
    46  		"amazon-private-ip":          new(FixerAmazonPrivateIP),
    47  		"amazon-temp-sec-cidrs":      new(FixerAmazonTemporarySecurityCIDRs),
    48  		"docker-email":               new(FixerDockerEmail),
    49  		"powershell-escapes":         new(FixerPowerShellEscapes),
    50  		"hyperv-deprecations":        new(FixerHypervDeprecations),
    51  		"hyperv-vmxc-typo":           new(FixerHypervVmxcTypo),
    52  		"hyperv-cpu-and-ram":         new(FizerHypervCPUandRAM),
    53  		"vmware-compaction":          new(FixerVMwareCompaction),
    54  		"clean-image-name":           new(FixerCleanImageName),
    55  		"spot-price-auto-product":    new(FixerAmazonSpotPriceProductDeprecation),
    56  		"qemu-disk-size":             new(FixerQEMUDiskSize),
    57  		"galaxy-command":             new(FixerGalaxyCommand),
    58  		"comm-config":                new(FixerCommConfig),
    59  		"ssh-wait-timeout":           new(FixerSSHTimout),
    60  		"docker-tag-tags":            new(FixerDockerTagtoTags),
    61  		"vsphere-iso-net-disk":       new(FixerVSphereNetworkDisk),
    62  		"iso-checksum-type-and-url":  new(FixerISOChecksumTypeAndURL),
    63  		"qemu-host-port":             new(FixerQEMUHostPort),
    64  		"azure-exclude_from_latest":  new(FixerAzureExcludeFromLatest),
    65  		"proxmox-type":               new(FixerProxmoxType),
    66  	}
    67  
    68  	FixerOrder = []string{
    69  		"iso-md5",
    70  		"createtime",
    71  		"virtualbox-gaattach",
    72  		"pp-vagrant-override",
    73  		"virtualbox-rename",
    74  		"vmware-rename",
    75  		"parallels-headless",
    76  		"parallels-deprecations",
    77  		"sshkeypath",
    78  		"sshdisableagent",
    79  		"scaleway-access-key",
    80  		"manifest-filename",
    81  		"amazon-shutdown_behavior",
    82  		"amazon-enhanced-networking",
    83  		"amazon-private-ip",
    84  		"amazon-temp-sec-cidrs",
    85  		"docker-email",
    86  		"docker-tag-tags",
    87  		"powershell-escapes",
    88  		"vmware-compaction",
    89  		"hyperv-deprecations",
    90  		"hyperv-vmxc-typo",
    91  		"hyperv-cpu-and-ram",
    92  		"clean-image-name",
    93  		"spot-price-auto-product",
    94  		"qemu-disk-size",
    95  		"galaxy-command",
    96  		"comm-config",
    97  		"ssh-wait-timeout",
    98  		"vsphere-iso-net-disk",
    99  		"iso-checksum-type-and-url",
   100  		"qemu-host-port",
   101  		"azure-exclude_from_latest",
   102  		"proxmox-type",
   103  	}
   104  }