move postprocessor to sdk, fix generation code
This commit is contained in:
parent
b4bc3f1c7b
commit
307f56f560
|
@ -148,7 +148,7 @@ func setupVMwareBuild(t *testing.T, builderConfig map[string]string, provisioner
|
|||
"shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
|
||||
},
|
||||
PostProcessorStore: packer.MapOfPostProcessor{
|
||||
"something": func() (packer.PostProcessor, error) { return &packer.MockPostProcessor{}, nil },
|
||||
"something": func() (packersdk.PostProcessor, error) { return &packer.MockPostProcessor{}, nil },
|
||||
},
|
||||
}
|
||||
config := packer.CoreConfig{
|
||||
|
|
|
@ -846,8 +846,8 @@ func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
|
|||
"file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil },
|
||||
},
|
||||
PostProcessorStore: packer.MapOfPostProcessor{
|
||||
"shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },
|
||||
"manifest": func() (packer.PostProcessor, error) { return &manifest.PostProcessor{}, nil },
|
||||
"shell-local": func() (packersdk.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },
|
||||
"manifest": func() (packersdk.PostProcessor, error) { return &manifest.PostProcessor{}, nil },
|
||||
},
|
||||
}
|
||||
return &packer.CoreConfig{
|
||||
|
|
|
@ -129,8 +129,8 @@ func getBareComponentFinder() packer.ComponentFinder {
|
|||
"file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil },
|
||||
},
|
||||
PostProcessorStore: packer.MapOfPostProcessor{
|
||||
"shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },
|
||||
"manifest": func() (packer.PostProcessor, error) { return &manifest.PostProcessor{}, nil },
|
||||
"shell-local": func() (packersdk.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },
|
||||
"manifest": func() (packersdk.PostProcessor, error) { return &manifest.PostProcessor{}, nil },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
"github.com/hashicorp/packer/packer/plugin"
|
||||
|
||||
|
@ -188,7 +187,7 @@ var Provisioners = map[string]packersdk.Provisioner{
|
|||
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
||||
}
|
||||
|
||||
var PostProcessors = map[string]packer.PostProcessor{
|
||||
var PostProcessors = map[string]packersdk.PostProcessor{
|
||||
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
||||
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
||||
"artifice": new(artificepostprocessor.PostProcessor),
|
||||
|
|
20
config.go
20
config.go
|
@ -103,12 +103,12 @@ func (c *config) loadSingleComponent(path string) (string, error) {
|
|||
}
|
||||
case strings.HasPrefix(pluginName, "packer-post-processor-"):
|
||||
pluginName = pluginName[len("packer-post-processor-"):]
|
||||
c.PostProcessors[pluginName] = func() (packer.PostProcessor, error) {
|
||||
c.PostProcessors[pluginName] = func() (packersdk.PostProcessor, error) {
|
||||
return c.pluginClient(path).PostProcessor()
|
||||
}
|
||||
case strings.HasPrefix(pluginName, "packer-provisioner-"):
|
||||
pluginName = pluginName[len("packer-provisioner-"):]
|
||||
c.Provisioners[pluginName] = func() (packer.Provisioner, error) {
|
||||
c.Provisioners[pluginName] = func() (packersdk.Provisioner, error) {
|
||||
return c.pluginClient(path).Provisioner()
|
||||
}
|
||||
}
|
||||
|
@ -194,16 +194,16 @@ func (c *config) StarHook(name string) (packersdk.Hook, error) {
|
|||
return c.pluginClient(name).Hook()
|
||||
}
|
||||
|
||||
// This is a proper packer.PostProcessorFunc that can be used to load
|
||||
// packer.PostProcessor implementations from defined plugins.
|
||||
func (c *config) StartPostProcessor(name string) (packer.PostProcessor, error) {
|
||||
// This is a proper packersdk.PostProcessorFunc that can be used to load
|
||||
// packersdk.PostProcessor implementations from defined plugins.
|
||||
func (c *config) StartPostProcessor(name string) (packersdk.PostProcessor, error) {
|
||||
log.Printf("Loading post-processor: %s", name)
|
||||
return c.PostProcessors.Start(name)
|
||||
}
|
||||
|
||||
// This is a proper packer.ProvisionerFunc that can be used to load
|
||||
// packer.Provisioner implementations from defined plugins.
|
||||
func (c *config) StartProvisioner(name string) (packer.Provisioner, error) {
|
||||
func (c *config) StartProvisioner(name string) (packersdk.Provisioner, error) {
|
||||
log.Printf("Loading provisioner: %s\n", name)
|
||||
return c.Provisioners.Start(name)
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ func (c *config) discoverExternalComponents(path string) error {
|
|||
}
|
||||
for pluginName, pluginPath := range pluginPaths {
|
||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
||||
c.PostProcessors[pluginName] = func() (packer.PostProcessor, error) {
|
||||
c.PostProcessors[pluginName] = func() (packersdk.PostProcessor, error) {
|
||||
return c.pluginClient(newPath).PostProcessor()
|
||||
}
|
||||
externallyUsed = append(externallyUsed, pluginName)
|
||||
|
@ -259,7 +259,7 @@ func (c *config) discoverExternalComponents(path string) error {
|
|||
}
|
||||
for pluginName, pluginPath := range pluginPaths {
|
||||
newPath := pluginPath // this needs to be stored in a new variable for the func below
|
||||
c.Provisioners[pluginName] = func() (packer.Provisioner, error) {
|
||||
c.Provisioners[pluginName] = func() (packersdk.Provisioner, error) {
|
||||
return c.pluginClient(newPath).Provisioner()
|
||||
}
|
||||
externallyUsed = append(externallyUsed, pluginName)
|
||||
|
@ -333,7 +333,7 @@ func (c *config) discoverInternalComponents() error {
|
|||
provisioner := provisioner
|
||||
_, found := (c.Provisioners)[provisioner]
|
||||
if !found {
|
||||
c.Provisioners[provisioner] = func() (packer.Provisioner, error) {
|
||||
c.Provisioners[provisioner] = func() (packersdk.Provisioner, error) {
|
||||
bin := fmt.Sprintf("%s%splugin%spacker-provisioner-%s",
|
||||
packerPath, PACKERSPACE, PACKERSPACE, provisioner)
|
||||
return c.pluginClient(bin).Provisioner()
|
||||
|
@ -345,7 +345,7 @@ func (c *config) discoverInternalComponents() error {
|
|||
postProcessor := postProcessor
|
||||
_, found := (c.PostProcessors)[postProcessor]
|
||||
if !found {
|
||||
c.PostProcessors[postProcessor] = func() (packer.PostProcessor, error) {
|
||||
c.PostProcessors[postProcessor] = func() (packersdk.PostProcessor, error) {
|
||||
bin := fmt.Sprintf("%s%splugin%spacker-post-processor-%s",
|
||||
packerPath, PACKERSPACE, PACKERSPACE, postProcessor)
|
||||
return c.pluginClient(bin).PostProcessor()
|
||||
|
|
|
@ -30,8 +30,8 @@ func getBasicParser() *Parser {
|
|||
"file": func() (packersdk.Provisioner, error) { return &MockProvisioner{}, nil },
|
||||
},
|
||||
PostProcessorsSchemas: packer.MapOfPostProcessor{
|
||||
"amazon-import": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil },
|
||||
"manifest": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil },
|
||||
"amazon-import": func() (packersdk.PostProcessor, error) { return &MockPostProcessor{}, nil },
|
||||
"manifest": func() (packersdk.PostProcessor, error) { return &MockPostProcessor{}, nil },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
|
@ -112,7 +111,7 @@ type MockPostProcessor struct {
|
|||
Config MockConfig
|
||||
}
|
||||
|
||||
var _ packer.PostProcessor = new(MockPostProcessor)
|
||||
var _ packersdk.PostProcessor = new(MockPostProcessor)
|
||||
|
||||
func (b *MockPostProcessor) ConfigSpec() hcldec.ObjectSpec {
|
||||
return b.Config.FlatMapstructure().HCL2Spec()
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/hcl/v2"
|
||||
"github.com/hashicorp/hcl/v2/gohcl"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
// ProvisionerBlock references a detected but unparsed post processor
|
||||
|
@ -61,7 +61,7 @@ func (p *Parser) decodePostProcessor(block *hcl.Block) (*PostProcessorBlock, hcl
|
|||
return postProcessor, diags
|
||||
}
|
||||
|
||||
func (cfg *PackerConfig) startPostProcessor(source SourceBlock, pp *PostProcessorBlock, ectx *hcl.EvalContext) (packer.PostProcessor, hcl.Diagnostics) {
|
||||
func (cfg *PackerConfig) startPostProcessor(source SourceBlock, pp *PostProcessorBlock, ectx *hcl.EvalContext) (packersdk.PostProcessor, hcl.Diagnostics) {
|
||||
// ProvisionerBlock represents a detected but unparsed provisioner
|
||||
var diags hcl.Diagnostics
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
|
||||
"github.com/hashicorp/hcl/v2"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
"github.com/zclconf/go-cty/cty"
|
||||
)
|
||||
|
@ -16,7 +15,7 @@ import (
|
|||
// calling PostProcess: with contextual variables.
|
||||
// This permits using "${build.ID}" values for example.
|
||||
type HCL2PostProcessor struct {
|
||||
PostProcessor packer.PostProcessor
|
||||
PostProcessor packersdk.PostProcessor
|
||||
postProcessorBlock *PostProcessorBlock
|
||||
evalContext *hcl.EvalContext
|
||||
builderVariables map[string]string
|
||||
|
|
|
@ -2,8 +2,6 @@ package packer
|
|||
|
||||
import (
|
||||
"context"
|
||||
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
// A PostProcessor is responsible for taking an artifact of a build
|
||||
|
@ -12,7 +10,7 @@ import (
|
|||
// the result of a build, compresses it, and returns a new artifact containing
|
||||
// a single file of the prior artifact compressed.
|
||||
type PostProcessor interface {
|
||||
packersdk.HCL2Speccer
|
||||
HCL2Speccer
|
||||
|
||||
// Configure is responsible for setting up configuration, storing
|
||||
// the state for later, and returning and errors, such as validation
|
||||
|
@ -26,5 +24,5 @@ type PostProcessor interface {
|
|||
// user input for keep_input_artifact is ignored and the artifact is either
|
||||
// kept or discarded according to the value set in `keep`.
|
||||
// PostProcess is cancellable using context
|
||||
PostProcess(context.Context, packersdk.Ui, packersdk.Artifact) (a packersdk.Artifact, keep bool, forceOverride bool, err error)
|
||||
PostProcess(context.Context, Ui, Artifact) (a Artifact, keep bool, forceOverride bool, err error)
|
||||
}
|
|
@ -118,7 +118,7 @@ type CoreBuild struct {
|
|||
// CoreBuildPostProcessor Keeps track of the post-processor and the
|
||||
// configuration of the post-processor used within a build.
|
||||
type CoreBuildPostProcessor struct {
|
||||
PostProcessor PostProcessor
|
||||
PostProcessor packersdk.PostProcessor
|
||||
PType string
|
||||
PName string
|
||||
config map[string]interface{}
|
||||
|
@ -130,7 +130,7 @@ type CoreBuildPostProcessor struct {
|
|||
type CoreBuildProvisioner struct {
|
||||
PType string
|
||||
PName string
|
||||
Provisioner Provisioner
|
||||
Provisioner packersdk.Provisioner
|
||||
config []interface{}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,10 @@ type BuilderFunc func(name string) (packersdk.Builder, error)
|
|||
type HookFunc func(name string) (packersdk.Hook, error)
|
||||
|
||||
// The function type used to lookup PostProcessor implementations.
|
||||
type PostProcessorFunc func(name string) (PostProcessor, error)
|
||||
type PostProcessorFunc func(name string) (packersdk.PostProcessor, error)
|
||||
|
||||
// The function type used to lookup Provisioner implementations.
|
||||
type ProvisionerFunc func(name string) (Provisioner, error)
|
||||
type ProvisionerFunc func(name string) (packersdk.Provisioner, error)
|
||||
|
||||
type BasicStore interface {
|
||||
Has(name string) bool
|
||||
|
@ -73,12 +73,12 @@ type BuilderStore interface {
|
|||
|
||||
type ProvisionerStore interface {
|
||||
BasicStore
|
||||
Start(name string) (Provisioner, error)
|
||||
Start(name string) (packersdk.Provisioner, error)
|
||||
}
|
||||
|
||||
type PostProcessorStore interface {
|
||||
BasicStore
|
||||
Start(name string) (PostProcessor, error)
|
||||
Start(name string) (packersdk.PostProcessor, error)
|
||||
}
|
||||
|
||||
// ComponentFinder is a struct that contains the various function
|
||||
|
|
|
@ -6,14 +6,14 @@ import (
|
|||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
type MapOfProvisioner map[string]func() (Provisioner, error)
|
||||
type MapOfProvisioner map[string]func() (packersdk.Provisioner, error)
|
||||
|
||||
func (mop MapOfProvisioner) Has(provisioner string) bool {
|
||||
_, res := mop[provisioner]
|
||||
return res
|
||||
}
|
||||
|
||||
func (mop MapOfProvisioner) Start(provisioner string) (Provisioner, error) {
|
||||
func (mop MapOfProvisioner) Start(provisioner string) (packersdk.Provisioner, error) {
|
||||
p, found := mop[provisioner]
|
||||
if !found {
|
||||
return nil, fmt.Errorf("Unknown provisioner %s", provisioner)
|
||||
|
@ -29,14 +29,14 @@ func (mop MapOfProvisioner) List() []string {
|
|||
return res
|
||||
}
|
||||
|
||||
type MapOfPostProcessor map[string]func() (PostProcessor, error)
|
||||
type MapOfPostProcessor map[string]func() (packersdk.PostProcessor, error)
|
||||
|
||||
func (mopp MapOfPostProcessor) Has(postProcessor string) bool {
|
||||
_, res := mopp[postProcessor]
|
||||
return res
|
||||
}
|
||||
|
||||
func (mopp MapOfPostProcessor) Start(postProcessor string) (PostProcessor, error) {
|
||||
func (mopp MapOfPostProcessor) Start(postProcessor string) (packersdk.PostProcessor, error) {
|
||||
p, found := mopp[postProcessor]
|
||||
if !found {
|
||||
return nil, fmt.Errorf("Unknown post-processor %s", postProcessor)
|
||||
|
|
|
@ -16,7 +16,6 @@ import (
|
|||
"time"
|
||||
"unicode"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
packrpc "github.com/hashicorp/packer/packer/rpc"
|
||||
)
|
||||
|
@ -153,7 +152,7 @@ func (c *Client) Hook() (packersdk.Hook, error) {
|
|||
|
||||
// Returns a post-processor implementation that is communicating over
|
||||
// this client. If the client hasn't been started, this will start it.
|
||||
func (c *Client) PostProcessor() (packer.PostProcessor, error) {
|
||||
func (c *Client) PostProcessor() (packersdk.PostProcessor, error) {
|
||||
client, err := c.packrpcClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
@ -5,12 +5,11 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
type cmdPostProcessor struct {
|
||||
p packer.PostProcessor
|
||||
p packersdk.PostProcessor
|
||||
client *Client
|
||||
}
|
||||
|
||||
|
|
|
@ -12,26 +12,9 @@ import (
|
|||
"github.com/hashicorp/packer/packer-plugin-sdk/packerbuilderdata"
|
||||
)
|
||||
|
||||
// A provisioner is responsible for installing and configuring software
|
||||
// on a machine prior to building the actual image.
|
||||
type Provisioner interface {
|
||||
packersdk.HCL2Speccer
|
||||
|
||||
// Prepare is called with a set of configurations to setup the
|
||||
// internal state of the provisioner. The multiple configurations
|
||||
// should be merged in some sane way.
|
||||
Prepare(...interface{}) error
|
||||
|
||||
// Provision is called to actually provision the machine. A context is
|
||||
// given for cancellation, a UI is given to communicate with the user, and
|
||||
// a communicator is given that is guaranteed to be connected to some
|
||||
// machine so that provisioning can be done.
|
||||
Provision(context.Context, packersdk.Ui, packersdk.Communicator, map[string]interface{}) error
|
||||
}
|
||||
|
||||
// A HookedProvisioner represents a provisioner and information describing it
|
||||
type HookedProvisioner struct {
|
||||
Provisioner Provisioner
|
||||
Provisioner packersdk.Provisioner
|
||||
Config interface{}
|
||||
TypeName string
|
||||
}
|
||||
|
@ -151,7 +134,7 @@ func (h *ProvisionHook) Run(ctx context.Context, name string, ui packersdk.Ui, c
|
|||
// the provisioner is actually run.
|
||||
type PausedProvisioner struct {
|
||||
PauseBefore time.Duration
|
||||
Provisioner Provisioner
|
||||
Provisioner packersdk.Provisioner
|
||||
}
|
||||
|
||||
func (p *PausedProvisioner) ConfigSpec() hcldec.ObjectSpec { return p.ConfigSpec() }
|
||||
|
@ -177,7 +160,7 @@ func (p *PausedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm
|
|||
// the provisioner whenever there's an error.
|
||||
type RetriedProvisioner struct {
|
||||
MaxRetries int
|
||||
Provisioner Provisioner
|
||||
Provisioner packersdk.Provisioner
|
||||
}
|
||||
|
||||
func (r *RetriedProvisioner) ConfigSpec() hcldec.ObjectSpec { return r.ConfigSpec() }
|
||||
|
@ -218,7 +201,7 @@ func (r *RetriedProvisioner) Provision(ctx context.Context, ui packersdk.Ui, com
|
|||
// DebuggedProvisioner is a Provisioner implementation that waits until a key
|
||||
// press before the provisioner is actually run.
|
||||
type DebuggedProvisioner struct {
|
||||
Provisioner Provisioner
|
||||
Provisioner packersdk.Provisioner
|
||||
|
||||
cancelCh chan struct{}
|
||||
doneCh chan struct{}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
// TimeoutProvisioner is a Provisioner implementation that can timeout after a
|
||||
// duration
|
||||
type TimeoutProvisioner struct {
|
||||
Provisioner
|
||||
packersdk.Provisioner
|
||||
Timeout time.Duration
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ func (c *Client) Hook() packersdk.Hook {
|
|||
}
|
||||
}
|
||||
|
||||
func (c *Client) PostProcessor() packer.PostProcessor {
|
||||
func (c *Client) PostProcessor() packersdk.PostProcessor {
|
||||
return &postProcessor{
|
||||
commonClient: commonClient{
|
||||
endpoint: DefaultPostProcessorEndpoint,
|
||||
|
|
|
@ -4,24 +4,23 @@ import (
|
|||
"context"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
// An implementation of packer.PostProcessor where the PostProcessor is actually
|
||||
// An implementation of packersdk.PostProcessor where the PostProcessor is actually
|
||||
// executed over an RPC connection.
|
||||
type postProcessor struct {
|
||||
commonClient
|
||||
}
|
||||
|
||||
// PostProcessorServer wraps a packer.PostProcessor implementation and makes it
|
||||
// PostProcessorServer wraps a packersdk.PostProcessor implementation and makes it
|
||||
// exportable as part of a Golang RPC server.
|
||||
type PostProcessorServer struct {
|
||||
context context.Context
|
||||
contextCancel func()
|
||||
|
||||
commonServer
|
||||
p packer.PostProcessor
|
||||
p packersdk.PostProcessor
|
||||
}
|
||||
|
||||
type PostProcessorConfigureArgs struct {
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
|
@ -134,7 +133,7 @@ func TestPostProcessorRPC_cancel(t *testing.T) {
|
|||
func TestPostProcessor_Implements(t *testing.T) {
|
||||
var raw interface{}
|
||||
raw = new(postProcessor)
|
||||
if _, ok := raw.(packer.PostProcessor); !ok {
|
||||
if _, ok := raw.(packersdk.PostProcessor); !ok {
|
||||
t.Fatal("not a postprocessor")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ func (s *Server) RegisterHook(h packersdk.Hook) error {
|
|||
})
|
||||
}
|
||||
|
||||
func (s *Server) RegisterPostProcessor(p packer.PostProcessor) error {
|
||||
func (s *Server) RegisterPostProcessor(p packersdk.PostProcessor) error {
|
||||
return s.server.RegisterName(DefaultPostProcessorEndpoint, &PostProcessorServer{
|
||||
commonServer: commonServer{
|
||||
selfConfigurable: p,
|
||||
|
|
|
@ -58,7 +58,7 @@ func TestProvisioner(t *testing.T, c *CoreConfig, n string) *MockProvisioner {
|
|||
var b MockProvisioner
|
||||
|
||||
c.Components.ProvisionerStore = MapOfProvisioner{
|
||||
n: func() (Provisioner, error) { return &b, nil },
|
||||
n: func() (packersdk.Provisioner, error) { return &b, nil },
|
||||
}
|
||||
|
||||
return &b
|
||||
|
@ -70,7 +70,7 @@ func TestPostProcessor(t *testing.T, c *CoreConfig, n string) *MockPostProcessor
|
|||
var b MockPostProcessor
|
||||
|
||||
c.Components.PostProcessorStore = MapOfPostProcessor{
|
||||
n: func() (PostProcessor, error) { return &b, nil },
|
||||
n: func() (packersdk.PostProcessor, error) { return &b, nil },
|
||||
}
|
||||
|
||||
return &b
|
||||
|
|
|
@ -3,11 +3,11 @@ package digitaloceanimport
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestPostProcessor_ImageArtifactExtraction(t *testing.T) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package dockerimport
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/builder/docker"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
dockerimport "github.com/hashicorp/packer/post-processor/docker-import"
|
||||
)
|
||||
|
@ -19,7 +18,7 @@ func testUi() *packersdk.BasicUi {
|
|||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestPostProcessor_PostProcess(t *testing.T) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package dockersave
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/builder/docker"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
dockerimport "github.com/hashicorp/packer/post-processor/docker-import"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
@ -36,7 +35,7 @@ func testUi() *packersdk.BasicUi {
|
|||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestPostProcessor_PostProcess(t *testing.T) {
|
||||
|
|
|
@ -6,12 +6,12 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func testConfig() map[string]interface{} {
|
||||
|
@ -23,7 +23,7 @@ func testConfig() map[string]interface{} {
|
|||
func TestPostProcessor_Impl(t *testing.T) {
|
||||
var raw interface{}
|
||||
raw = &PostProcessor{}
|
||||
if _, ok := raw.(packer.PostProcessor); !ok {
|
||||
if _, ok := raw.(packersdk.PostProcessor); !ok {
|
||||
t.Fatalf("must be a post processor")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//go:generate mapstructure-to-hcl2 -type Config
|
||||
|
||||
// vagrant_cloud implements the packer.PostProcessor interface and adds a
|
||||
// vagrant_cloud implements the packersdk.PostProcessor interface and adds a
|
||||
// post-processor that uploads artifacts from the vagrant post-processor
|
||||
// and vagrant builder to Vagrant Cloud (vagrantcloud.com) or manages
|
||||
// self hosted boxes on the Vagrant Cloud
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
@ -425,7 +424,7 @@ func testUi() *packersdk.BasicUi {
|
|||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestProviderFromBuilderName(t *testing.T) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//go:generate mapstructure-to-hcl2 -type Config
|
||||
|
||||
// vagrant implements the packer.PostProcessor interface and adds a
|
||||
// vagrant implements the packersdk.PostProcessor interface and adds a
|
||||
// post-processor that turns artifacts of known builders into Vagrant
|
||||
// boxes.
|
||||
package vagrant
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
|
||||
)
|
||||
|
||||
|
@ -34,7 +33,7 @@ func testUi() *packersdk.BasicUi {
|
|||
}
|
||||
|
||||
func TestPostProcessor_ImplementsPostProcessor(t *testing.T) {
|
||||
var _ packer.PostProcessor = new(PostProcessor)
|
||||
var _ packersdk.PostProcessor = new(PostProcessor)
|
||||
}
|
||||
|
||||
func TestPostProcessorPrepare_compressionLevel(t *testing.T) {
|
||||
|
|
|
@ -97,7 +97,7 @@ type plugin struct {
|
|||
func makeMap(varName, varType string, items []plugin) string {
|
||||
output := ""
|
||||
|
||||
output += fmt.Sprintf("var %s = map[string]packer.%s{\n", varName, varType)
|
||||
output += fmt.Sprintf("var %s = map[string]packersdk.%s{\n", varName, varType)
|
||||
for _, item := range items {
|
||||
output += fmt.Sprintf("\t\"%s\": new(%s.%s),\n", item.PluginName, item.ImportName, item.TypeName)
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- Code generated from the comments of the Builder struct in builder/hyperv/iso/builder.go; DO NOT EDIT MANUALLY -->
|
||||
|
||||
Builder implements packer.Builder and builds the actual Hyperv
|
||||
Builder implements packersdk.Builder and builds the actual Hyperv
|
||||
images.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- Code generated from the comments of the Builder struct in builder/hyperv/vmcx/builder.go; DO NOT EDIT MANUALLY -->
|
||||
|
||||
Builder implements packer.Builder and builds the actual Hyperv
|
||||
Builder implements packersdk.Builder and builds the actual Hyperv
|
||||
images.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<!-- Code generated from the comments of the Builder struct in builder/vagrant/builder.go; DO NOT EDIT MANUALLY -->
|
||||
|
||||
Builder implements packer.Builder and builds the actual VirtualBox
|
||||
Builder implements packersdk.Builder and builds the actual VirtualBox
|
||||
images.
|
||||
|
|
Loading…
Reference in New Issue