rework fixer deprecation code so we know what plugins they relate to

This commit is contained in:
Megan Marsh 2020-10-09 17:01:55 -07:00
parent ee4b3e796e
commit c0ce8a9414
101 changed files with 353 additions and 141 deletions

View File

@ -46,6 +46,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -194,6 +194,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -85,6 +85,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -84,6 +84,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -100,6 +100,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
SourceAMI: `{{ .SourceAMI }} `,
}
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
}, raws...)

View File

@ -107,6 +107,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -153,6 +153,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs["vm"] = CreateVMMetadataTemplateFunc()
md := &mapstructure.Metadata{}
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderID,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -89,6 +89,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: hypervcommon.BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -82,6 +82,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: hypervcommon.BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -17,6 +17,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BUILDER_ID,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -21,6 +21,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateFilter: &interpolate.RenderFilter{},
}, raws...)

View File

@ -40,6 +40,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
}, raws...)

View File

@ -45,6 +45,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = osccommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -46,6 +46,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = osccommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -53,6 +53,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
SourceOMI: `{{ .SourceOMI }} `,
}
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
}, raws...)

View File

@ -66,6 +66,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = osccommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -87,6 +87,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -35,6 +35,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -27,6 +27,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
errs := &multierror.Error{}
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
}, raws...)

View File

@ -38,6 +38,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -154,6 +154,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -117,6 +117,7 @@ func (b *Builder) ConfigSpec() hcldec.ObjectSpec { return b.config.FlatMapstruct
func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: vboxcommon.BuilderId, // "mitchellh.virtualbox"
Interpolate: true,
InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -82,6 +82,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{
PluginType: vboxcommon.BuilderId, // "mitchellh.virtualbox"
Interpolate: true,
InterpolateContext: &c.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -66,6 +66,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{
PluginType: vboxcommon.BuilderId, // "mitchellh.virtualbox"
Interpolate: true,
InterpolateContext: &c.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -52,6 +52,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{
PluginType: common.BuilderId,
Interpolate: true,
InterpolateContext: &c.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -53,6 +53,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{
PluginType: common.BuilderId,
Interpolate: true,
InterpolateContext: &c.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -1,8 +1,10 @@
package main
import (
"bytes"
"flag"
"fmt"
"go/format"
"os"
"path/filepath"
"strings"
@ -11,20 +13,19 @@ import (
"github.com/hashicorp/packer/fix"
)
var deprecatedOptsTemplate = template.Must(template.New("deprecatedOptsTemplate").
Parse(`//<!-- Code generated by generate-fixer-deprecations; DO NOT EDIT MANUALLY -->
var deprecatedOptsTemplate = template.Must(template.New("deprecatedOptsTemplate").Funcs(template.FuncMap{"StringsJoin": strings.Join}).Parse(`//<!-- Code generated by generate-fixer-deprecations; DO NOT EDIT MANUALLY -->
package config
var DeprecatedOptions = []string{
{{- range .DeprecatedOpts}}
"{{.}}",
var DeprecatedOptions = map[string][]string{
{{- range $key, $value := .DeprecatedOpts}}
"{{$key}}": []string{"{{ StringsJoin . "\", \"" }}"},
{{- end}}
}
`))
type executeOpts struct {
DeprecatedOpts []string
DeprecatedOpts map[string][]string
}
func main() {
@ -45,7 +46,7 @@ func main() {
packerDir := paths[0]
// Load all deprecated options from all active fixers
allDeprecatedOpts := []string{}
allDeprecatedOpts := map[string][]string{}
for _, name := range fix.FixerOrder {
fixer, ok := fix.Fixers[name]
if !ok {
@ -53,20 +54,35 @@ func main() {
}
deprecated := fixer.DeprecatedOptions()
allDeprecatedOpts = append(allDeprecatedOpts, deprecated...)
for k, v := range deprecated {
if allDeprecatedOpts[k] == nil {
allDeprecatedOpts[k] = v
} else {
allDeprecatedOpts[k] = append(allDeprecatedOpts[k], v...)
}
}
}
deprecated_path := filepath.Join(packerDir, "helper", "config",
"deprecated_options.go")
buf := bytes.Buffer{}
// execute template into buffer
deprecated := &executeOpts{DeprecatedOpts: allDeprecatedOpts}
err = deprecatedOptsTemplate.Execute(&buf, deprecated)
// we've written unformatted go code to the file. now we have to format it.
out, err := format.Source(buf.Bytes())
if err != nil {
panic(err)
}
outputFile, err := os.Create(deprecated_path)
if err != nil {
panic(err)
}
_, err = outputFile.Write(out)
defer outputFile.Close()
deprecated := &executeOpts{DeprecatedOpts: allDeprecatedOpts}
err = deprecatedOptsTemplate.Execute(outputFile, deprecated)
if err != nil {
fmt.Printf("%v", err)
os.Exit(1)

View File

@ -6,7 +6,7 @@ type Fixer interface {
// this fixer. It is used to generate a list of deprecated options that the
// template parser checks against to warn users that they need to call
// `packer fix` against their templates after upgrading.
DeprecatedOptions() []string
DeprecatedOptions() map[string][]string
// Fix takes a raw map structure input, potentially transforms it
// in some way, and returns the new, transformed structure. The

View File

@ -10,8 +10,10 @@ import (
// with the clearer "ena_support". This disambiguates ena_support from sriov_support.
type FixerAmazonEnhancedNetworking struct{}
func (FixerAmazonEnhancedNetworking) DeprecatedOptions() []string {
return []string{"enhanced_networking"}
func (FixerAmazonEnhancedNetworking) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"enhanced_networking"},
}
}
func (FixerAmazonEnhancedNetworking) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -12,8 +12,10 @@ import (
// true` with `"ssh_interface": "private_ip"`
type FixerAmazonPrivateIP struct{}
func (FixerAmazonPrivateIP) DeprecatedOptions() []string {
return []string{"ssh_private_ip"}
func (FixerAmazonPrivateIP) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"ssh_private_ip"},
}
}
func (FixerAmazonPrivateIP) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,8 +10,10 @@ import (
// template in a Amazon builder
type FixerAmazonShutdownBehavior struct{}
func (FixerAmazonShutdownBehavior) DeprecatedOptions() []string {
return []string{"shutdown_behaviour"}
func (FixerAmazonShutdownBehavior) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"shutdown_behaviour"},
}
}
func (FixerAmazonShutdownBehavior) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// from Amazon builder templates
type FixerAmazonSpotPriceProductDeprecation struct{}
func (FixerAmazonSpotPriceProductDeprecation) DeprecatedOptions() []string {
return []string{"spot_price_auto_product"}
func (FixerAmazonSpotPriceProductDeprecation) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"spot_price_auto_product"},
}
}
func (FixerAmazonSpotPriceProductDeprecation) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
type FixerAmazonTemporarySecurityCIDRs struct{}
func (FixerAmazonTemporarySecurityCIDRs) DeprecatedOptions() []string {
return []string{"temporary_security_group_source_cidr"}
func (FixerAmazonTemporarySecurityCIDRs) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"temporary_security_group_source_cidr"},
}
}
func (FixerAmazonTemporarySecurityCIDRs) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,8 +10,10 @@ import (
// template in an Azure builder
type FixerAzureExcludeFromLatest struct{}
func (FixerAzureExcludeFromLatest) DeprecatedOptions() []string {
return []string{"exlude_from_latest"}
func (FixerAzureExcludeFromLatest) DeprecatedOptions() map[string][]string {
return map[string][]string{
"Azure*": []string{"exlude_from_latest"},
}
}
func (FixerAzureExcludeFromLatest) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -11,8 +11,12 @@ import (
// calls with "clean_resource_name"
type FixerCleanImageName struct{}
func (FixerCleanImageName) DeprecatedOptions() []string {
return []string{"clean_image_name", "clean_ami_name"}
func (FixerCleanImageName) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*amazon*": []string{"clean_ami_name"},
"packer.googlecompute": []string{"clean_image_name"},
"Azure*": []string{"clean_image_name"},
}
}
func (FixerCleanImageName) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,9 +10,11 @@ import (
// for variables host_port_min, host_port_max, skip_nat_mapping
type FixerCommConfig struct{}
func (FixerCommConfig) DeprecatedOptions() []string {
return []string{"ssh_host_port_min", "ssh_host_port_max",
"ssh_skip_nat_mapping"}
func (FixerCommConfig) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"ssh_host_port_min", "ssh_host_port_max",
"ssh_skip_nat_mapping"},
}
}
func (FixerCommConfig) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,8 +10,8 @@ import (
// calls with "{{timestamp}"
type FixerCreateTime struct{}
func (FixerCreateTime) DeprecatedOptions() []string {
return []string{}
func (FixerCreateTime) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerCreateTime) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -4,8 +4,12 @@ import "github.com/mitchellh/mapstructure"
type FixerDockerEmail struct{}
func (FixerDockerEmail) DeprecatedOptions() []string {
return []string{"login_email"}
func (FixerDockerEmail) DeprecatedOptions() map[string][]string {
return map[string][]string{
"packer.docker": []string{"login_email"},
"packer.post-processor.docker-import": []string{"login_email"},
}
}
func (FixerDockerEmail) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// environment variables and replace galaxycommand with galaxy_command
type FixerGalaxyCommand struct{}
func (FixerGalaxyCommand) DeprecatedOptions() []string {
return []string{"galaxycommand"}
func (FixerGalaxyCommand) DeprecatedOptions() map[string][]string {
return map[string][]string{
"ansible": []string{"galaxycommand"},
}
}
func (FixerGalaxyCommand) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -4,12 +4,13 @@ import (
"github.com/mitchellh/mapstructure"
)
// FizerHypervCPUandRAM fixes the typo in "clone_from_vmxc_path" replacing
// it with "clone_from_vmcx_path" in Hyper-V VMCX builder templates
// FizerHypervCPUandRAM changes `cpu` to `cpus` and `ram_size` to `memory`
type FizerHypervCPUandRAM struct{}
func (FizerHypervCPUandRAM) DeprecatedOptions() []string {
return []string{"cpu", "ram_size"}
func (FizerHypervCPUandRAM) DeprecatedOptions() map[string][]string {
return map[string][]string{
"MSOpenTech.hyperv": []string{"cpu", "ram_size"},
}
}
func (FizerHypervCPUandRAM) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// from Hyper-V ISO builder templates
type FixerHypervDeprecations struct{}
func (FixerHypervDeprecations) DeprecatedOptions() []string {
return []string{"vhd_temp_path"}
func (FixerHypervDeprecations) DeprecatedOptions() map[string][]string {
return map[string][]string{
"MSOpenTech.hyperv": []string{"vhd_temp_path"},
}
}
func (FixerHypervDeprecations) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// it with "clone_from_vmcx_path" in Hyper-V VMCX builder templates
type FixerHypervVmxcTypo struct{}
func (FixerHypervVmxcTypo) DeprecatedOptions() []string {
return []string{"clone_from_vmxc_path"}
func (FixerHypervVmxcTypo) DeprecatedOptions() map[string][]string {
return map[string][]string{
"MSOpenTech.hyperv": []string{"clone_from_vmxc_path"},
}
}
func (FixerHypervVmxcTypo) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// "iso_checksum_type" to put everything in the checksum field.
type FixerISOChecksumTypeAndURL struct{}
func (FixerISOChecksumTypeAndURL) DeprecatedOptions() []string {
return []string{"iso_checksum_url", "iso_checksum_type"}
func (FixerISOChecksumTypeAndURL) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"iso_checksum_url", "iso_checksum_type"},
}
}
func (FixerISOChecksumTypeAndURL) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// with the newer "iso_checksum" and "iso_checksum_type" within builders.
type FixerISOMD5 struct{}
func (FixerISOMD5) DeprecatedOptions() []string {
return []string{"iso_md5"}
func (FixerISOMD5) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"iso_md5"},
}
}
func (FixerISOMD5) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -9,8 +9,10 @@ import (
// "guest_os_type", possibly overwriting any existing "guest_os_type"
type FixerParallelsDeprecations struct{}
func (FixerParallelsDeprecations) DeprecatedOptions() []string {
return []string{"parallels_tools_host_path", "guest_os_distribution"}
func (FixerParallelsDeprecations) DeprecatedOptions() map[string][]string {
return map[string][]string{
"packer.parallels": []string{"parallels_tools_host_path", "guest_os_distribution"},
}
}
func (FixerParallelsDeprecations) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,10 @@ import (
// FixerParallelsHeadless removes "headless" from a template in a Parallels builder
type FixerParallelsHeadless struct{}
func (FixerParallelsHeadless) DeprecatedOptions() []string {
return []string{"headless"}
func (FixerParallelsHeadless) DeprecatedOptions() map[string][]string {
return map[string][]string{
"packer.parallels": []string{"headless"},
}
}
func (FixerParallelsHeadless) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,8 +10,8 @@ import (
// environment variables and elevated username and password strings
type FixerPowerShellEscapes struct{}
func (FixerPowerShellEscapes) DeprecatedOptions() []string {
return []string{}
func (FixerPowerShellEscapes) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerPowerShellEscapes) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -9,8 +9,10 @@ import (
// FixerDockerTagtoTags renames tag to tags
type FixerDockerTagtoTags struct{}
func (FixerDockerTagtoTags) DeprecatedOptions() []string {
return []string{"tag"}
func (FixerDockerTagtoTags) DeprecatedOptions() map[string][]string {
return map[string][]string{
"packer.post-processor.docker-tag": []string{"tag"},
}
}
func (FixerDockerTagtoTags) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,10 @@ import (
// FixerManifestFilename renames any Filename to Output
type FixerManifestFilename struct{}
func (FixerManifestFilename) DeprecatedOptions() []string {
return []string{"filename"}
func (FixerManifestFilename) DeprecatedOptions() map[string][]string {
return map[string][]string{
"packer.post-processor.manifest": []string{"filename"},
}
}
func (FixerManifestFilename) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,8 @@ import "github.com/mitchellh/mapstructure"
// as part of Packer 0.5.0.
type FixerVagrantPPOverride struct{}
func (FixerVagrantPPOverride) DeprecatedOptions() []string {
return []string{}
func (FixerVagrantPPOverride) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerVagrantPPOverride) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -9,8 +9,8 @@ import (
// FixerQEMUDiskSize updates disk_size from a string to int for QEMU builders
type FixerQEMUDiskSize struct{}
func (FixerQEMUDiskSize) DeprecatedOptions() []string {
return []string{}
func (FixerQEMUDiskSize) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerQEMUDiskSize) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -56,6 +56,8 @@ func (FixerQEMUHostPort) Synopsis() string {
return `Updates ssh_host_port_min and ssh_host_port_max to host_port_min and host_port_max`
}
func (FixerQEMUHostPort) DeprecatedOptions() []string {
return []string{"ssh_host_port_max", "ssh_host_port_min"}
func (FixerQEMUHostPort) DeprecatedOptions() map[string][]string {
return map[string][]string{
"transcend.qemu": []string{"ssh_host_port_max", "ssh_host_port_min"},
}
}

View File

@ -8,8 +8,10 @@ import (
// to "organization_id".
type FixerScalewayAccessKey struct{}
func (FixerScalewayAccessKey) DeprecatedOptions() []string {
return []string{"access_key"}
func (FixerScalewayAccessKey) DeprecatedOptions() map[string][]string {
return map[string][]string{
"hashicorp.scaleway": []string{"access_key"},
}
}
func (FixerScalewayAccessKey) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,10 @@ import (
// FixerSSHTimout replaces ssh_wait_timeout with ssh_timeout
type FixerSSHTimout struct{}
func (FixerSSHTimout) DeprecatedOptions() []string {
return []string{"ssh_wait_timeout"}
func (FixerSSHTimout) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"ssh_wait_timeout"},
}
}
func (FixerSSHTimout) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// to "ssh_disable_agent_forwarding".
type FixerSSHDisableAgent struct{}
func (FixerSSHDisableAgent) DeprecatedOptions() []string {
return []string{"ssh_disable_agent"}
func (FixerSSHDisableAgent) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"ssh_disable_agent"},
}
}
func (FixerSSHDisableAgent) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// to "ssh_private_key_file".
type FixerSSHKeyPath struct{}
func (FixerSSHKeyPath) DeprecatedOptions() []string {
return []string{"ssh_key_path"}
func (FixerSSHKeyPath) DeprecatedOptions() map[string][]string {
return map[string][]string{
"*": []string{"ssh_key_path"},
}
}
func (FixerSSHKeyPath) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -8,8 +8,10 @@ import (
// to "guest_additions_mode".
type FixerVirtualBoxGAAttach struct{}
func (FixerVirtualBoxGAAttach) DeprecatedOptions() []string {
return []string{"guest_additions_attach"}
func (FixerVirtualBoxGAAttach) DeprecatedOptions() map[string][]string {
return map[string][]string{
"mitchellh.virtualbox": []string{"guest_additions_attach"},
}
}
func (FixerVirtualBoxGAAttach) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,8 @@ import (
// FixerVirtualBoxRename changes "virtualbox" builders to "virtualbox-iso"
type FixerVirtualBoxRename struct{}
func (FixerVirtualBoxRename) DeprecatedOptions() []string {
return []string{}
func (FixerVirtualBoxRename) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerVirtualBoxRename) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,8 @@ import (
// FixerVMwareCompaction adds "skip_compaction = true" to "vmware-iso" builders with incompatible disk_type_id
type FixerVMwareCompaction struct{}
func (FixerVMwareCompaction) DeprecatedOptions() []string {
return []string{}
func (FixerVMwareCompaction) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerVMwareCompaction) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -7,8 +7,8 @@ import (
// FixerVMwareRename changes "vmware" builders to "vmware-iso"
type FixerVMwareRename struct{}
func (FixerVMwareRename) DeprecatedOptions() []string {
return []string{}
func (FixerVMwareRename) DeprecatedOptions() map[string][]string {
return map[string][]string{}
}
func (FixerVMwareRename) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -9,9 +9,11 @@ import (
// disk_eagerly_scrub into a storage adapter
type FixerVSphereNetworkDisk struct{}
func (FixerVSphereNetworkDisk) DeprecatedOptions() []string {
return []string{"network_card", "network", "networkCard", "disk_size",
"disk_thin_provisioned", "disk_eagerly_scrub"}
func (FixerVSphereNetworkDisk) DeprecatedOptions() map[string][]string {
return map[string][]string{
"jetbrains.vsphere": []string{"network_card", "network", "networkCard", "disk_size",
"disk_thin_provisioned", "disk_eagerly_scrub"},
}
}
func (FixerVSphereNetworkDisk) Fix(input map[string]interface{}) (map[string]interface{}, error) {

2
go.mod
View File

@ -93,6 +93,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.0.3 // indirect
github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed
github.com/mitchellh/gox v1.0.1 // indirect
github.com/mitchellh/iochan v1.0.0
github.com/mitchellh/mapstructure v1.2.3
github.com/mitchellh/panicwrap v1.0.0
@ -111,6 +112,7 @@ require (
github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca
github.com/posener/complete v1.2.3
github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible
github.com/ryanuber/go-glob v1.0.0
github.com/satori/go.uuid v1.2.0 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7
github.com/shirou/gopsutil v2.18.12+incompatible

3
go.sum
View File

@ -377,6 +377,7 @@ github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
@ -511,6 +512,8 @@ github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZX
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI=
github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4=
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=

View File

@ -12,6 +12,7 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/template/interpolate"
"github.com/mitchellh/mapstructure"
"github.com/ryanuber/go-glob"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/gocty"
ctyjson "github.com/zclconf/go-cty/cty/json"
@ -30,6 +31,11 @@ type DecodeOpts struct {
InterpolateContext *interpolate.Context
InterpolateFilter *interpolate.RenderFilter
// PluginType is the BuilderID, etc of the plugin -- it is used to
// determine whether to tell the user to "fix" their template if an
// unknown option is a deprecated one for this plugin type.
PluginType string
DecodeHooks []mapstructure.DecodeHookFunc
}
@ -43,6 +49,7 @@ var DefaultDecodeHookFuncs = []mapstructure.DecodeHookFunc{
// Decode decodes the configuration into the target and optionally
// automatically interpolates all the configuration as it goes.
func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
// loop over raws once to get cty values from hcl, if that's a thing.
for i, raw := range raws {
// check for cty values and transform them to json then to a
// map[string]interface{} so that mapstructure can do its thing.
@ -85,6 +92,9 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
p.Set(reflect.Zero(p.Type()))
}
}
// Now perform the normal decode.
if config == nil {
config = &DecodeOpts{Interpolate: true}
}
@ -138,30 +148,44 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
if err != nil {
return err
}
// In practice, raws is two interfaces: one containing all the packer config
// vars, and one containing the raw json configuration for a single
// plugin.
for _, raw := range raws {
if err := decoder.Decode(raw); err != nil {
return err
}
}
// If we have unused keys, it is an error
if len(md.Unused) > 0 {
var err error
sort.Strings(md.Unused)
for _, unused := range md.Unused {
if unused == "type" || strings.HasPrefix(unused, "packer_") {
continue
}
// Set the metadata if it is set
if config.Metadata != nil {
*config.Metadata = md
}
// If we have unused keys, it is an error
if len(md.Unused) > 0 {
var err error
sort.Strings(md.Unused)
for _, unused := range md.Unused {
if unused != "type" && !strings.HasPrefix(unused, "packer_") {
// Check for whether the key is handled in a packer fix
// call.
fixable := false
for _, deprecatedOption := range DeprecatedOptions {
if unused == deprecatedOption {
fixable = true
break
// check whether the deprecation option can be fixed using packer fix.
if config.PluginType != "" {
for k, deprecatedOptions := range DeprecatedOptions {
// the deprecated options keys are globbable, for
// example "amazon*" for all amazon builders, or * for
// all builders
if glob.Glob(k, config.PluginType) {
for _, deprecatedOption := range deprecatedOptions {
if unused == deprecatedOption {
fixable = true
break
}
}
}
if fixable == true {
break
}
}
}
@ -179,10 +203,15 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
err = multierror.Append(err, unusedErr)
}
if err != nil {
return err
}
}
if err != nil {
return err
}
}
// Set the metadata if it is set
if config.Metadata != nil {
*config.Metadata = md
}
return nil

View File

@ -2,6 +2,7 @@ package config
import (
"reflect"
"strings"
"testing"
"time"
@ -133,3 +134,73 @@ func TestDecode(t *testing.T) {
}
}
}
func TestDecode_fixerRecommendations(t *testing.T) {
type TestConfig struct {
Name string
}
cases := []struct {
Reason string
Input []interface{}
Opts *DecodeOpts
Expected string
}{
{
Reason: "If no plugin type is provided, don't try to match fixer options",
Input: []interface{}{
map[string]interface{}{
"name": "bar",
"iso_md5": "13123412341234",
},
},
Opts: &DecodeOpts{},
Expected: `unknown configuration key: '"iso_md5"'`,
},
{
Reason: "iso_md5 should always recommend packer fix regardless of plugin type",
Input: []interface{}{
map[string]interface{}{
"name": "bar",
"iso_md5": "13123412341234",
},
},
Opts: &DecodeOpts{PluginType: "someplugin"},
Expected: `Deprecated configuration key: 'iso_md5'`,
},
{
Reason: "filename option should generate a fixer recommendation for the manifest postprocessor",
Input: []interface{}{
map[string]interface{}{
"name": "bar",
"filename": "fakefilename",
},
},
Opts: &DecodeOpts{PluginType: "packer.post-processor.manifest"},
Expected: `Deprecated configuration key: 'filename'`,
},
{
Reason: "filename option should generate an unknown key error for other plugins",
Input: []interface{}{
map[string]interface{}{
"name": "bar",
"filename": "fakefilename",
},
},
Opts: &DecodeOpts{PluginType: "randomplugin"},
Expected: `unknown configuration key: '"filename"'`,
},
}
for _, tc := range cases {
var result TestConfig
err := Decode(&result, tc.Opts, tc.Input...)
if err == nil {
t.Fatalf("Should have had an error: %s", tc.Reason)
}
if !strings.Contains(err.Error(), tc.Expected) {
t.Fatalf("Expected: %s\nActual: %s\n; Reason: %s", tc.Expected, err.Error(), tc.Reason)
}
}
}

View File

@ -2,43 +2,20 @@
package config
var DeprecatedOptions = []string{
"iso_md5",
"guest_additions_attach",
"headless",
"parallels_tools_host_path",
"guest_os_distribution",
"ssh_key_path",
"ssh_disable_agent",
"access_key",
"filename",
"shutdown_behaviour",
"enhanced_networking",
"ssh_private_ip",
"temporary_security_group_source_cidr",
"login_email",
"tag",
"vhd_temp_path",
"clone_from_vmxc_path",
"cpu",
"ram_size",
"clean_image_name",
"clean_ami_name",
"spot_price_auto_product",
"galaxycommand",
"ssh_host_port_min",
"ssh_host_port_max",
"ssh_skip_nat_mapping",
"ssh_wait_timeout",
"network_card",
"network",
"networkCard",
"disk_size",
"disk_thin_provisioned",
"disk_eagerly_scrub",
"iso_checksum_url",
"iso_checksum_type",
"ssh_host_port_max",
"ssh_host_port_min",
"exlude_from_latest",
var DeprecatedOptions = map[string][]string{
"*": []string{"iso_md5", "ssh_key_path", "ssh_disable_agent", "ssh_host_port_min", "ssh_host_port_max", "ssh_skip_nat_mapping", "ssh_wait_timeout", "iso_checksum_url", "iso_checksum_type"},
"*amazon*": []string{"shutdown_behaviour", "enhanced_networking", "ssh_private_ip", "temporary_security_group_source_cidr", "clean_ami_name", "spot_price_auto_product"},
"Azure*": []string{"clean_image_name", "exlude_from_latest"},
"MSOpenTech.hyperv": []string{"vhd_temp_path", "clone_from_vmxc_path", "cpu", "ram_size"},
"ansible": []string{"galaxycommand"},
"hashicorp.scaleway": []string{"access_key"},
"jetbrains.vsphere": []string{"network_card", "network", "networkCard", "disk_size", "disk_thin_provisioned", "disk_eagerly_scrub"},
"mitchellh.virtualbox": []string{"guest_additions_attach"},
"packer.docker": []string{"login_email"},
"packer.googlecompute": []string{"clean_image_name"},
"packer.parallels": []string{"headless", "parallels_tools_host_path", "guest_os_distribution"},
"packer.post-processor.docker-import": []string{"login_email"},
"packer.post-processor.docker-tag": []string{"tag"},
"packer.post-processor.manifest": []string{"filename"},
"transcend.qemu": []string{"ssh_host_port_max", "ssh_host_port_min"},
}

View File

@ -116,6 +116,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -59,6 +59,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
p.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -37,6 +37,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "artifice",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -56,6 +56,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "checksum",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -59,6 +59,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "compress",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -77,6 +77,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -35,6 +35,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -40,6 +40,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderIdImport,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -37,6 +37,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -39,6 +39,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -71,6 +71,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
}, raws...)

View File

@ -74,6 +74,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -51,6 +51,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "manifest",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -83,7 +83,6 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{

View File

@ -63,6 +63,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -56,6 +56,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: vsphere.BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -64,6 +64,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -65,6 +65,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -67,6 +67,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -82,6 +82,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "ansible-local",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -223,6 +223,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
p.done = make(chan struct{})
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "ansible",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -74,6 +74,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
// WinRMPassword: `{{.WinRMPassword}}`,
// }
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "azure-dtlartifact",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -32,6 +32,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "breakpoint",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -126,6 +126,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "chef-client",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -106,6 +106,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "chef-solo",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -63,6 +63,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(
&p.config,
&config.DecodeOpts{
PluginType: "converge",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -68,6 +68,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "file",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -75,6 +75,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
p.done = make(chan struct{})
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "inspec",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -117,6 +117,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "powershell",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -155,6 +155,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "puppet-masterless",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -149,6 +149,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "puppet-server",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -118,6 +118,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "salt-masterless",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -75,6 +75,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "shell",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

View File

@ -68,6 +68,7 @@ func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMapst
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "windows-restart",
Interpolate: true,
InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{

Some files were not shown because too many files have changed in this diff Show More