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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = awscommon.TemplateFuncs b.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{

View File

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

View File

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

View File

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

View File

@ -21,6 +21,7 @@ type Config struct {
func (c *Config) Prepare(raws ...interface{}) ([]string, error) { func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
err := config.Decode(c, &config.DecodeOpts{ err := config.Decode(c, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateFilter: &interpolate.RenderFilter{}, InterpolateFilter: &interpolate.RenderFilter{},
}, raws...) }, 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
}, raws...) }, 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.ctx.Funcs = osccommon.TemplateFuncs b.config.ctx.Funcs = osccommon.TemplateFuncs
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{

View File

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

View File

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

View File

@ -27,6 +27,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
errs := &multierror.Error{} errs := &multierror.Error{}
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
}, raws...) }, 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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) { func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
err := config.Decode(&b.config, &config.DecodeOpts{ err := config.Decode(&b.config, &config.DecodeOpts{
PluginType: vboxcommon.BuilderId, // "mitchellh.virtualbox"
Interpolate: true, Interpolate: true,
InterpolateContext: &b.config.ctx, InterpolateContext: &b.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,10 @@
package main package main
import ( import (
"bytes"
"flag" "flag"
"fmt" "fmt"
"go/format"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -11,20 +13,19 @@ import (
"github.com/hashicorp/packer/fix" "github.com/hashicorp/packer/fix"
) )
var deprecatedOptsTemplate = template.Must(template.New("deprecatedOptsTemplate"). var deprecatedOptsTemplate = template.Must(template.New("deprecatedOptsTemplate").Funcs(template.FuncMap{"StringsJoin": strings.Join}).Parse(`//<!-- Code generated by generate-fixer-deprecations; DO NOT EDIT MANUALLY -->
Parse(`//<!-- Code generated by generate-fixer-deprecations; DO NOT EDIT MANUALLY -->
package config package config
var DeprecatedOptions = []string{ var DeprecatedOptions = map[string][]string{
{{- range .DeprecatedOpts}} {{- range $key, $value := .DeprecatedOpts}}
"{{.}}", "{{$key}}": []string{"{{ StringsJoin . "\", \"" }}"},
{{- end}} {{- end}}
} }
`)) `))
type executeOpts struct { type executeOpts struct {
DeprecatedOpts []string DeprecatedOpts map[string][]string
} }
func main() { func main() {
@ -45,7 +46,7 @@ func main() {
packerDir := paths[0] packerDir := paths[0]
// Load all deprecated options from all active fixers // Load all deprecated options from all active fixers
allDeprecatedOpts := []string{} allDeprecatedOpts := map[string][]string{}
for _, name := range fix.FixerOrder { for _, name := range fix.FixerOrder {
fixer, ok := fix.Fixers[name] fixer, ok := fix.Fixers[name]
if !ok { if !ok {
@ -53,20 +54,35 @@ func main() {
} }
deprecated := fixer.DeprecatedOptions() 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_path := filepath.Join(packerDir, "helper", "config",
"deprecated_options.go") "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) outputFile, err := os.Create(deprecated_path)
if err != nil { if err != nil {
panic(err) panic(err)
} }
_, err = outputFile.Write(out)
defer outputFile.Close() defer outputFile.Close()
deprecated := &executeOpts{DeprecatedOpts: allDeprecatedOpts}
err = deprecatedOptsTemplate.Execute(outputFile, deprecated)
if err != nil { if err != nil {
fmt.Printf("%v", err) fmt.Printf("%v", err)
os.Exit(1) 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 // 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 // template parser checks against to warn users that they need to call
// `packer fix` against their templates after upgrading. // `packer fix` against their templates after upgrading.
DeprecatedOptions() []string DeprecatedOptions() map[string][]string
// Fix takes a raw map structure input, potentially transforms it // Fix takes a raw map structure input, potentially transforms it
// in some way, and returns the new, transformed structure. The // 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. // with the clearer "ena_support". This disambiguates ena_support from sriov_support.
type FixerAmazonEnhancedNetworking struct{} type FixerAmazonEnhancedNetworking struct{}
func (FixerAmazonEnhancedNetworking) DeprecatedOptions() []string { func (FixerAmazonEnhancedNetworking) DeprecatedOptions() map[string][]string {
return []string{"enhanced_networking"} return map[string][]string{
"*amazon*": []string{"enhanced_networking"},
}
} }
func (FixerAmazonEnhancedNetworking) Fix(input map[string]interface{}) (map[string]interface{}, error) { func (FixerAmazonEnhancedNetworking) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,8 +11,12 @@ import (
// calls with "clean_resource_name" // calls with "clean_resource_name"
type FixerCleanImageName struct{} type FixerCleanImageName struct{}
func (FixerCleanImageName) DeprecatedOptions() []string { func (FixerCleanImageName) DeprecatedOptions() map[string][]string {
return []string{"clean_image_name", "clean_ami_name"} 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) { 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 // for variables host_port_min, host_port_max, skip_nat_mapping
type FixerCommConfig struct{} type FixerCommConfig struct{}
func (FixerCommConfig) DeprecatedOptions() []string { func (FixerCommConfig) DeprecatedOptions() map[string][]string {
return []string{"ssh_host_port_min", "ssh_host_port_max", return map[string][]string{
"ssh_skip_nat_mapping"} "*": []string{"ssh_host_port_min", "ssh_host_port_max",
"ssh_skip_nat_mapping"},
}
} }
func (FixerCommConfig) Fix(input map[string]interface{}) (map[string]interface{}, error) { func (FixerCommConfig) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

@ -10,8 +10,8 @@ import (
// calls with "{{timestamp}" // calls with "{{timestamp}"
type FixerCreateTime struct{} type FixerCreateTime struct{}
func (FixerCreateTime) DeprecatedOptions() []string { func (FixerCreateTime) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerCreateTime) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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{} type FixerDockerEmail struct{}
func (FixerDockerEmail) DeprecatedOptions() []string { func (FixerDockerEmail) DeprecatedOptions() map[string][]string {
return []string{"login_email"} 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) { 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 // environment variables and replace galaxycommand with galaxy_command
type FixerGalaxyCommand struct{} type FixerGalaxyCommand struct{}
func (FixerGalaxyCommand) DeprecatedOptions() []string { func (FixerGalaxyCommand) DeprecatedOptions() map[string][]string {
return []string{"galaxycommand"} return map[string][]string{
"ansible": []string{"galaxycommand"},
}
} }
func (FixerGalaxyCommand) Fix(input map[string]interface{}) (map[string]interface{}, error) { func (FixerGalaxyCommand) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

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

View File

@ -8,8 +8,10 @@ import (
// from Hyper-V ISO builder templates // from Hyper-V ISO builder templates
type FixerHypervDeprecations struct{} type FixerHypervDeprecations struct{}
func (FixerHypervDeprecations) DeprecatedOptions() []string { func (FixerHypervDeprecations) DeprecatedOptions() map[string][]string {
return []string{"vhd_temp_path"} return map[string][]string{
"MSOpenTech.hyperv": []string{"vhd_temp_path"},
}
} }
func (FixerHypervDeprecations) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // it with "clone_from_vmcx_path" in Hyper-V VMCX builder templates
type FixerHypervVmxcTypo struct{} type FixerHypervVmxcTypo struct{}
func (FixerHypervVmxcTypo) DeprecatedOptions() []string { func (FixerHypervVmxcTypo) DeprecatedOptions() map[string][]string {
return []string{"clone_from_vmxc_path"} return map[string][]string{
"MSOpenTech.hyperv": []string{"clone_from_vmxc_path"},
}
} }
func (FixerHypervVmxcTypo) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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. // "iso_checksum_type" to put everything in the checksum field.
type FixerISOChecksumTypeAndURL struct{} type FixerISOChecksumTypeAndURL struct{}
func (FixerISOChecksumTypeAndURL) DeprecatedOptions() []string { func (FixerISOChecksumTypeAndURL) DeprecatedOptions() map[string][]string {
return []string{"iso_checksum_url", "iso_checksum_type"} return map[string][]string{
"*": []string{"iso_checksum_url", "iso_checksum_type"},
}
} }
func (FixerISOChecksumTypeAndURL) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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. // with the newer "iso_checksum" and "iso_checksum_type" within builders.
type FixerISOMD5 struct{} type FixerISOMD5 struct{}
func (FixerISOMD5) DeprecatedOptions() []string { func (FixerISOMD5) DeprecatedOptions() map[string][]string {
return []string{"iso_md5"} return map[string][]string{
"*": []string{"iso_md5"},
}
} }
func (FixerISOMD5) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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" // "guest_os_type", possibly overwriting any existing "guest_os_type"
type FixerParallelsDeprecations struct{} type FixerParallelsDeprecations struct{}
func (FixerParallelsDeprecations) DeprecatedOptions() []string { func (FixerParallelsDeprecations) DeprecatedOptions() map[string][]string {
return []string{"parallels_tools_host_path", "guest_os_distribution"} 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) { 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 // FixerParallelsHeadless removes "headless" from a template in a Parallels builder
type FixerParallelsHeadless struct{} type FixerParallelsHeadless struct{}
func (FixerParallelsHeadless) DeprecatedOptions() []string { func (FixerParallelsHeadless) DeprecatedOptions() map[string][]string {
return []string{"headless"} return map[string][]string{
"packer.parallels": []string{"headless"},
}
} }
func (FixerParallelsHeadless) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // environment variables and elevated username and password strings
type FixerPowerShellEscapes struct{} type FixerPowerShellEscapes struct{}
func (FixerPowerShellEscapes) DeprecatedOptions() []string { func (FixerPowerShellEscapes) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerPowerShellEscapes) Fix(input map[string]interface{}) (map[string]interface{}, error) { func (FixerPowerShellEscapes) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

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

View File

@ -7,8 +7,10 @@ import (
// FixerManifestFilename renames any Filename to Output // FixerManifestFilename renames any Filename to Output
type FixerManifestFilename struct{} type FixerManifestFilename struct{}
func (FixerManifestFilename) DeprecatedOptions() []string { func (FixerManifestFilename) DeprecatedOptions() map[string][]string {
return []string{"filename"} return map[string][]string{
"packer.post-processor.manifest": []string{"filename"},
}
} }
func (FixerManifestFilename) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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. // as part of Packer 0.5.0.
type FixerVagrantPPOverride struct{} type FixerVagrantPPOverride struct{}
func (FixerVagrantPPOverride) DeprecatedOptions() []string { func (FixerVagrantPPOverride) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerVagrantPPOverride) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // FixerQEMUDiskSize updates disk_size from a string to int for QEMU builders
type FixerQEMUDiskSize struct{} type FixerQEMUDiskSize struct{}
func (FixerQEMUDiskSize) DeprecatedOptions() []string { func (FixerQEMUDiskSize) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerQEMUDiskSize) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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` return `Updates ssh_host_port_min and ssh_host_port_max to host_port_min and host_port_max`
} }
func (FixerQEMUHostPort) DeprecatedOptions() []string { func (FixerQEMUHostPort) DeprecatedOptions() map[string][]string {
return []string{"ssh_host_port_max", "ssh_host_port_min"} 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". // to "organization_id".
type FixerScalewayAccessKey struct{} type FixerScalewayAccessKey struct{}
func (FixerScalewayAccessKey) DeprecatedOptions() []string { func (FixerScalewayAccessKey) DeprecatedOptions() map[string][]string {
return []string{"access_key"} return map[string][]string{
"hashicorp.scaleway": []string{"access_key"},
}
} }
func (FixerScalewayAccessKey) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // FixerSSHTimout replaces ssh_wait_timeout with ssh_timeout
type FixerSSHTimout struct{} type FixerSSHTimout struct{}
func (FixerSSHTimout) DeprecatedOptions() []string { func (FixerSSHTimout) DeprecatedOptions() map[string][]string {
return []string{"ssh_wait_timeout"} return map[string][]string{
"*": []string{"ssh_wait_timeout"},
}
} }
func (FixerSSHTimout) Fix(input map[string]interface{}) (map[string]interface{}, error) { func (FixerSSHTimout) Fix(input map[string]interface{}) (map[string]interface{}, error) {

View File

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

View File

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

View File

@ -8,8 +8,10 @@ import (
// to "guest_additions_mode". // to "guest_additions_mode".
type FixerVirtualBoxGAAttach struct{} type FixerVirtualBoxGAAttach struct{}
func (FixerVirtualBoxGAAttach) DeprecatedOptions() []string { func (FixerVirtualBoxGAAttach) DeprecatedOptions() map[string][]string {
return []string{"guest_additions_attach"} return map[string][]string{
"mitchellh.virtualbox": []string{"guest_additions_attach"},
}
} }
func (FixerVirtualBoxGAAttach) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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" // FixerVirtualBoxRename changes "virtualbox" builders to "virtualbox-iso"
type FixerVirtualBoxRename struct{} type FixerVirtualBoxRename struct{}
func (FixerVirtualBoxRename) DeprecatedOptions() []string { func (FixerVirtualBoxRename) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerVirtualBoxRename) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // FixerVMwareCompaction adds "skip_compaction = true" to "vmware-iso" builders with incompatible disk_type_id
type FixerVMwareCompaction struct{} type FixerVMwareCompaction struct{}
func (FixerVMwareCompaction) DeprecatedOptions() []string { func (FixerVMwareCompaction) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerVMwareCompaction) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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" // FixerVMwareRename changes "vmware" builders to "vmware-iso"
type FixerVMwareRename struct{} type FixerVMwareRename struct{}
func (FixerVMwareRename) DeprecatedOptions() []string { func (FixerVMwareRename) DeprecatedOptions() map[string][]string {
return []string{} return map[string][]string{}
} }
func (FixerVMwareRename) Fix(input map[string]interface{}) (map[string]interface{}, error) { 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 // disk_eagerly_scrub into a storage adapter
type FixerVSphereNetworkDisk struct{} type FixerVSphereNetworkDisk struct{}
func (FixerVSphereNetworkDisk) DeprecatedOptions() []string { func (FixerVSphereNetworkDisk) DeprecatedOptions() map[string][]string {
return []string{"network_card", "network", "networkCard", "disk_size", return map[string][]string{
"disk_thin_provisioned", "disk_eagerly_scrub"} "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) { 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-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.0.3 // indirect github.com/mitchellh/go-testing-interface v1.0.3 // indirect
github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed 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/iochan v1.0.0
github.com/mitchellh/mapstructure v1.2.3 github.com/mitchellh/mapstructure v1.2.3
github.com/mitchellh/panicwrap v1.0.0 github.com/mitchellh/panicwrap v1.0.0
@ -111,6 +112,7 @@ require (
github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca github.com/pkg/sftp v0.0.0-20160118190721-e84cc8c755ca
github.com/posener/complete v1.2.3 github.com/posener/complete v1.2.3
github.com/profitbricks/profitbricks-sdk-go v4.0.2+incompatible 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/satori/go.uuid v1.2.0 // indirect
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7
github.com/shirou/gopsutil v2.18.12+incompatible 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.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 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE=
github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= 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 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= 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= 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 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= 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 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 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 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/hcl/v2/hcldec"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
"github.com/mitchellh/mapstructure" "github.com/mitchellh/mapstructure"
"github.com/ryanuber/go-glob"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/gocty" "github.com/zclconf/go-cty/cty/gocty"
ctyjson "github.com/zclconf/go-cty/cty/json" ctyjson "github.com/zclconf/go-cty/cty/json"
@ -30,6 +31,11 @@ type DecodeOpts struct {
InterpolateContext *interpolate.Context InterpolateContext *interpolate.Context
InterpolateFilter *interpolate.RenderFilter 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 DecodeHooks []mapstructure.DecodeHookFunc
} }
@ -43,6 +49,7 @@ var DefaultDecodeHookFuncs = []mapstructure.DecodeHookFunc{
// Decode decodes the configuration into the target and optionally // Decode decodes the configuration into the target and optionally
// automatically interpolates all the configuration as it goes. // automatically interpolates all the configuration as it goes.
func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error { 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 { for i, raw := range raws {
// check for cty values and transform them to json then to a // check for cty values and transform them to json then to a
// map[string]interface{} so that mapstructure can do its thing. // 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())) p.Set(reflect.Zero(p.Type()))
} }
} }
// Now perform the normal decode.
if config == nil { if config == nil {
config = &DecodeOpts{Interpolate: true} config = &DecodeOpts{Interpolate: true}
} }
@ -138,30 +148,44 @@ func Decode(target interface{}, config *DecodeOpts, raws ...interface{}) error {
if err != nil { if err != nil {
return err 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 { for _, raw := range raws {
if err := decoder.Decode(raw); err != nil { if err := decoder.Decode(raw); err != nil {
return err 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 // Check for whether the key is handled in a packer fix
// call. // call.
fixable := false fixable := false
for _, deprecatedOption := range DeprecatedOptions {
if unused == deprecatedOption { // check whether the deprecation option can be fixed using packer fix.
fixable = true if config.PluginType != "" {
break 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) 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 return nil

View File

@ -2,6 +2,7 @@ package config
import ( import (
"reflect" "reflect"
"strings"
"testing" "testing"
"time" "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 package config
var DeprecatedOptions = []string{ var DeprecatedOptions = map[string][]string{
"iso_md5", "*": []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"},
"guest_additions_attach", "*amazon*": []string{"shutdown_behaviour", "enhanced_networking", "ssh_private_ip", "temporary_security_group_source_cidr", "clean_ami_name", "spot_price_auto_product"},
"headless", "Azure*": []string{"clean_image_name", "exlude_from_latest"},
"parallels_tools_host_path", "MSOpenTech.hyperv": []string{"vhd_temp_path", "clone_from_vmxc_path", "cpu", "ram_size"},
"guest_os_distribution", "ansible": []string{"galaxycommand"},
"ssh_key_path", "hashicorp.scaleway": []string{"access_key"},
"ssh_disable_agent", "jetbrains.vsphere": []string{"network_card", "network", "networkCard", "disk_size", "disk_thin_provisioned", "disk_eagerly_scrub"},
"access_key", "mitchellh.virtualbox": []string{"guest_additions_attach"},
"filename", "packer.docker": []string{"login_email"},
"shutdown_behaviour", "packer.googlecompute": []string{"clean_image_name"},
"enhanced_networking", "packer.parallels": []string{"headless", "parallels_tools_host_path", "guest_os_distribution"},
"ssh_private_ip", "packer.post-processor.docker-import": []string{"login_email"},
"temporary_security_group_source_cidr", "packer.post-processor.docker-tag": []string{"tag"},
"login_email", "packer.post-processor.manifest": []string{"filename"},
"tag", "transcend.qemu": []string{"ssh_host_port_max", "ssh_host_port_min"},
"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",
} }

View File

@ -116,6 +116,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
p.config.ctx.Funcs = awscommon.TemplateFuncs p.config.ctx.Funcs = awscommon.TemplateFuncs
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "artifice",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "checksum",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "compress",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderIdImport,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
}, raws...) }, raws...)

View File

@ -74,6 +74,7 @@ func (p *PostProcessor) ConfigSpec() hcldec.ObjectSpec { return p.config.FlatMap
func (p *PostProcessor) Configure(raws ...interface{}) error { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "manifest",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{
Exclude: []string{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: vsphere.BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *PostProcessor) Configure(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: BuilderId,
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "ansible-local",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{

View File

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

View File

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

View File

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

View File

@ -75,6 +75,7 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
p.done = make(chan struct{}) p.done = make(chan struct{})
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "inspec",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "powershell",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "puppet-masterless",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "puppet-server",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "salt-masterless",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "shell",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ 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 { func (p *Provisioner) Prepare(raws ...interface{}) error {
err := config.Decode(&p.config, &config.DecodeOpts{ err := config.Decode(&p.config, &config.DecodeOpts{
PluginType: "windows-restart",
Interpolate: true, Interpolate: true,
InterpolateContext: &p.config.ctx, InterpolateContext: &p.config.ctx,
InterpolateFilter: &interpolate.RenderFilter{ InterpolateFilter: &interpolate.RenderFilter{

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