|
9 | 9 | "github.com/hashicorp/hcp-sdk-go/clients/cloud-packer-service/preview/2021-04-30/models" |
10 | 10 | packersdk "github.com/hashicorp/packer-plugin-sdk/packer" |
11 | 11 | registryimage "github.com/hashicorp/packer-plugin-sdk/packer/registry/image" |
12 | | - "github.com/hashicorp/packer-plugin-sdk/template/config" |
13 | 12 | packerregistry "github.com/hashicorp/packer/internal/registry" |
| 13 | + "github.com/mitchellh/mapstructure" |
14 | 14 | ) |
15 | 15 |
|
16 | 16 | type RegistryPostProcessor struct { |
@@ -61,9 +61,18 @@ func (p *RegistryPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui |
61 | 61 | return source, false, false, err |
62 | 62 | } |
63 | 63 |
|
64 | | - state := source.State(registryimage.ArtifactStateURI) |
65 | 64 | var images []registryimage.Image |
66 | | - err = config.Decode(&images, &config.DecodeOpts{}, state) |
| 65 | + decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ |
| 66 | + Result: &images, |
| 67 | + WeaklyTypedInput: true, |
| 68 | + ErrorUnused: true, |
| 69 | + }) |
| 70 | + if err != nil { |
| 71 | + return source, false, false, fmt.Errorf("failed to create decoder for HCP Packer registry image: %w", err) |
| 72 | + } |
| 73 | + |
| 74 | + state := source.State(registryimage.ArtifactStateURI) |
| 75 | + err = decoder.Decode(state) |
67 | 76 | if err != nil { |
68 | 77 | return source, false, false, fmt.Errorf("failed to obtain HCP Packer registry image from post-processor artifact: %w", err) |
69 | 78 | } |
|
0 commit comments