move provisioner interface into sdk

This commit is contained in:
Megan Marsh 2020-12-01 14:25:14 -08:00
parent faa3832537
commit b4bc3f1c7b
37 changed files with 75 additions and 62 deletions

View File

@ -145,7 +145,7 @@ func setupVMwareBuild(t *testing.T, builderConfig map[string]string, provisioner
return &packersdk.DispatchHook{}, nil return &packersdk.DispatchHook{}, nil
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
}, },
PostProcessorStore: packer.MapOfPostProcessor{ PostProcessorStore: packer.MapOfPostProcessor{
"something": func() (packer.PostProcessor, error) { return &packer.MockPostProcessor{}, nil }, "something": func() (packer.PostProcessor, error) { return &packer.MockPostProcessor{}, nil },

View File

@ -74,7 +74,7 @@ func testMetaParallel(t *testing.T, builder *ParallelTestBuilder, locked *Locked
"lock": func() (packersdk.Builder, error) { return locked, nil }, "lock": func() (packersdk.Builder, error) { return locked, nil },
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil }, "sleep": func() (packersdk.Provisioner, error) { return &sleep.Provisioner{}, nil },
}, },
}, },
}, },

View File

@ -841,9 +841,9 @@ func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
"null": func() (packersdk.Builder, error) { return &null.Builder{}, nil }, "null": func() (packersdk.Builder, error) { return &null.Builder{}, nil },
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil },
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
"file": func() (packer.Provisioner, error) { return &filep.Provisioner{}, nil }, "file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil },
}, },
PostProcessorStore: packer.MapOfPostProcessor{ PostProcessorStore: packer.MapOfPostProcessor{
"shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, "shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },

View File

@ -20,8 +20,8 @@ func testCoreConfigSleepBuilder(t *testing.T) *packer.CoreConfig {
"file": func() (packersdk.Builder, error) { return &file.Builder{}, nil }, "file": func() (packersdk.Builder, error) { return &file.Builder{}, nil },
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"sleep": func() (packer.Provisioner, error) { return &sleep.Provisioner{}, nil }, "sleep": func() (packersdk.Provisioner, error) { return &sleep.Provisioner{}, nil },
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil },
}, },
} }
return &packer.CoreConfig{ return &packer.CoreConfig{

View File

@ -124,9 +124,9 @@ func getBareComponentFinder() packer.ComponentFinder {
"amazon-ebs": func() (packersdk.Builder, error) { return &ebs.Builder{}, nil }, "amazon-ebs": func() (packersdk.Builder, error) { return &ebs.Builder{}, nil },
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"shell-local": func() (packer.Provisioner, error) { return &shell_local.Provisioner{}, nil }, "shell-local": func() (packersdk.Provisioner, error) { return &shell_local.Provisioner{}, nil },
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
"file": func() (packer.Provisioner, error) { return &filep.Provisioner{}, nil }, "file": func() (packersdk.Provisioner, error) { return &filep.Provisioner{}, nil },
}, },
PostProcessorStore: packer.MapOfPostProcessor{ PostProcessorStore: packer.MapOfPostProcessor{
"shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil }, "shell-local": func() (packer.PostProcessor, error) { return &shell_local_pp.PostProcessor{}, nil },

View File

@ -167,7 +167,7 @@ var Builders = map[string]packersdk.Builder{
"yandex": new(yandexbuilder.Builder), "yandex": new(yandexbuilder.Builder),
} }
var Provisioners = map[string]packer.Provisioner{ var Provisioners = map[string]packersdk.Provisioner{
"ansible": new(ansibleprovisioner.Provisioner), "ansible": new(ansibleprovisioner.Provisioner),
"ansible-local": new(ansiblelocalprovisioner.Provisioner), "ansible-local": new(ansiblelocalprovisioner.Provisioner),
"azure-dtlartifact": new(azuredtlartifactprovisioner.Provisioner), "azure-dtlartifact": new(azuredtlartifactprovisioner.Provisioner),

View File

@ -26,8 +26,8 @@ func getBasicParser() *Parser {
"null": func() (packersdk.Builder, error) { return &null.Builder{}, nil }, "null": func() (packersdk.Builder, error) { return &null.Builder{}, nil },
}, },
ProvisionersSchemas: packer.MapOfProvisioner{ ProvisionersSchemas: packer.MapOfProvisioner{
"shell": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &MockProvisioner{}, nil },
"file": func() (packer.Provisioner, error) { return &MockProvisioner{}, nil }, "file": func() (packersdk.Provisioner, error) { return &MockProvisioner{}, nil },
}, },
PostProcessorsSchemas: packer.MapOfPostProcessor{ PostProcessorsSchemas: packer.MapOfPostProcessor{
"amazon-import": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil }, "amazon-import": func() (packer.PostProcessor, error) { return &MockPostProcessor{}, nil },

View File

@ -90,7 +90,7 @@ type MockProvisioner struct {
Config MockConfig Config MockConfig
} }
var _ packer.Provisioner = new(MockProvisioner) var _ packersdk.Provisioner = new(MockProvisioner)
func (b *MockProvisioner) ConfigSpec() hcldec.ObjectSpec { func (b *MockProvisioner) ConfigSpec() hcldec.ObjectSpec {
return b.Config.FlatMapstructure().HCL2Spec() return b.Config.FlatMapstructure().HCL2Spec()

View File

@ -7,7 +7,7 @@ import (
"github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/gohcl" "github.com/hashicorp/hcl/v2/gohcl"
hcl2shim "github.com/hashicorp/packer/hcl2template/shim" hcl2shim "github.com/hashicorp/packer/hcl2template/shim"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
@ -148,7 +148,7 @@ func (p *Parser) decodeProvisioner(block *hcl.Block, cfg *PackerConfig) (*Provis
return provisioner, diags return provisioner, diags
} }
func (cfg *PackerConfig) startProvisioner(source SourceBlock, pb *ProvisionerBlock, ectx *hcl.EvalContext) (packer.Provisioner, hcl.Diagnostics) { func (cfg *PackerConfig) startProvisioner(source SourceBlock, pb *ProvisionerBlock, ectx *hcl.EvalContext) (packersdk.Provisioner, hcl.Diagnostics) {
var diags hcl.Diagnostics var diags hcl.Diagnostics
provisioner, err := cfg.provisionersSchemas.Start(pb.PType) provisioner, err := cfg.provisionersSchemas.Start(pb.PType)

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2" "github.com/hashicorp/hcl/v2"
"github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
@ -16,7 +15,7 @@ import (
// calling Provision: with contextual variables. // calling Provision: with contextual variables.
// This permits using "${build.ID}" values for example. // This permits using "${build.ID}" values for example.
type HCL2Provisioner struct { type HCL2Provisioner struct {
Provisioner packer.Provisioner Provisioner packersdk.Provisioner
provisionerBlock *ProvisionerBlock provisionerBlock *ProvisionerBlock
evalContext *hcl.EvalContext evalContext *hcl.EvalContext
builderVariables map[string]string builderVariables map[string]string

View File

@ -29,8 +29,8 @@ func testCoreConfigBuilder(t *testing.T) *packer.CoreConfig {
"amazon-ebs": func() (packersdk.Builder, error) { return &amazonebsbuilder.Builder{}, nil }, "amazon-ebs": func() (packersdk.Builder, error) { return &amazonebsbuilder.Builder{}, nil },
}, },
ProvisionerStore: packer.MapOfProvisioner{ ProvisionerStore: packer.MapOfProvisioner{
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
"file": func() (packer.Provisioner, error) { return &fileprovisioner.Provisioner{}, nil }, "file": func() (packersdk.Provisioner, error) { return &fileprovisioner.Provisioner{}, nil },
}, },
PostProcessorStore: packer.MapOfPostProcessor{}, PostProcessorStore: packer.MapOfPostProcessor{},
} }

View File

@ -0,0 +1,20 @@
package packer
import "context"
// A provisioner is responsible for installing and configuring software
// on a machine prior to building the actual image.
type Provisioner interface {
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, Ui, Communicator, map[string]interface{}) error
}

View File

@ -164,7 +164,7 @@ func (c *Client) PostProcessor() (packer.PostProcessor, error) {
// Returns a provisioner implementation that is communicating over this // Returns a provisioner implementation that is communicating over this
// client. If the client hasn't been started, this will start it. // client. If the client hasn't been started, this will start it.
func (c *Client) Provisioner() (packer.Provisioner, error) { func (c *Client) Provisioner() (packersdk.Provisioner, error) {
client, err := c.packrpcClient() client, err := c.packrpcClient()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -5,12 +5,11 @@ import (
"log" "log"
"github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
type cmdProvisioner struct { type cmdProvisioner struct {
p packer.Provisioner p packersdk.Provisioner
client *Client client *Client
} }

View File

@ -129,7 +129,7 @@ func (c *Client) PostProcessor() packer.PostProcessor {
} }
} }
func (c *Client) Provisioner() packer.Provisioner { func (c *Client) Provisioner() packersdk.Provisioner {
return &provisioner{ return &provisioner{
commonClient: commonClient{ commonClient: commonClient{
endpoint: DefaultProvisionerEndpoint, endpoint: DefaultProvisionerEndpoint,

View File

@ -4,24 +4,23 @@ import (
"context" "context"
"log" "log"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
// An implementation of packer.Provisioner where the provisioner is actually // An implementation of packersdk.Provisioner where the provisioner is actually
// executed over an RPC connection. // executed over an RPC connection.
type provisioner struct { type provisioner struct {
commonClient commonClient
} }
// ProvisionerServer wraps a packer.Provisioner implementation and makes it // ProvisionerServer wraps a packersdk.Provisioner implementation and makes it
// exportable as part of a Golang RPC server. // exportable as part of a Golang RPC server.
type ProvisionerServer struct { type ProvisionerServer struct {
context context.Context context context.Context
contextCancel func() contextCancel func()
commonServer commonServer
p packer.Provisioner p packersdk.Provisioner
} }
type ProvisionerPrepareArgs struct { type ProvisionerPrepareArgs struct {

View File

@ -50,5 +50,5 @@ func TestProvisionerRPC(t *testing.T) {
} }
func TestProvisioner_Implements(t *testing.T) { func TestProvisioner_Implements(t *testing.T) {
var _ packer.Provisioner = new(provisioner) var _ packersdk.Provisioner = new(provisioner)
} }

View File

@ -113,7 +113,7 @@ func (s *Server) RegisterPostProcessor(p packer.PostProcessor) error {
}) })
} }
func (s *Server) RegisterProvisioner(p packer.Provisioner) error { func (s *Server) RegisterProvisioner(p packersdk.Provisioner) error {
return s.server.RegisterName(DefaultProvisionerEndpoint, &ProvisionerServer{ return s.server.RegisterName(DefaultProvisionerEndpoint, &ProvisionerServer{
commonServer: commonServer{ commonServer: commonServer{
selfConfigurable: p, selfConfigurable: p,

View File

@ -21,7 +21,7 @@ import (
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -14,7 +14,6 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config" confighelper "github.com/hashicorp/packer/packer-plugin-sdk/template/config"
@ -43,7 +42,7 @@ func testConfig(t *testing.T) map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -7,7 +7,6 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
@ -20,7 +19,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -6,6 +6,7 @@ import (
"testing" "testing"
"github.com/hashicorp/packer/packer" "github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -15,7 +16,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -3,7 +3,7 @@ package converge
import ( import (
"testing" "testing"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -21,7 +21,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatal("must be a Provisioner") t.Fatal("must be a Provisioner")
} }
} }

View File

@ -23,7 +23,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a provisioner") t.Fatalf("must be a provisioner")
} }
} }

View File

@ -10,7 +10,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
// Be sure to remove the InSpec stub file in each test with: // Be sure to remove the InSpec stub file in each test with:
@ -35,7 +35,7 @@ func testConfig(t *testing.T) map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -65,8 +65,8 @@ func (s *PowershellProvisionerAccTest) GetConfig() (string, error) {
func (s *PowershellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { func (s *PowershellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner {
return packer.MapOfProvisioner{ return packer.MapOfProvisioner{
TestProvisionerName: func() (packer.Provisioner, error) { return &powershell.Provisioner{}, nil }, TestProvisionerName: func() (packersdk.Provisioner, error) { return &powershell.Provisioner{}, nil },
"windows-shell": func() (packer.Provisioner, error) { return &windowsshellprovisioner.Provisioner{}, nil }, "windows-shell": func() (packersdk.Provisioner, error) { return &windowsshellprovisioner.Provisioner{}, nil },
} }
} }

View File

@ -46,7 +46,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -32,7 +32,7 @@ func testConfig() (config map[string]interface{}, tf *os.File) {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -5,7 +5,7 @@ import (
"os" "os"
"testing" "testing"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func testConfig() (config map[string]interface{}, tf *os.File) { func testConfig() (config map[string]interface{}, tf *os.File) {
@ -24,7 +24,7 @@ func testConfig() (config map[string]interface{}, tf *os.File) {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -6,7 +6,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -18,7 +18,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -42,7 +42,7 @@ func (s *ShellLocalProvisionerAccTest) GetConfig() (string, error) {
func (s *ShellLocalProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { func (s *ShellLocalProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner {
return packer.MapOfProvisioner{ return packer.MapOfProvisioner{
"shell-local": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell-local": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
} }
} }

View File

@ -3,11 +3,11 @@ package shell
import ( import (
"testing" "testing"
"github.com/hashicorp/packer/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func TestProvisioner_impl(t *testing.T) { func TestProvisioner_impl(t *testing.T) {
var _ packer.Provisioner = new(Provisioner) var _ packersdk.Provisioner = new(Provisioner)
} }
func TestConfigPrepare(t *testing.T) { func TestConfigPrepare(t *testing.T) {

View File

@ -45,8 +45,8 @@ func (s *ShellProvisionerAccTest) GetConfig() (string, error) {
func (s *ShellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner { func (s *ShellProvisionerAccTest) GetProvisionerStore() packer.MapOfProvisioner {
return packer.MapOfProvisioner{ return packer.MapOfProvisioner{
"shell": func() (packer.Provisioner, error) { return &shell.Provisioner{}, nil }, "shell": func() (packersdk.Provisioner, error) { return &shell.Provisioner{}, nil },
"file": func() (packer.Provisioner, error) { return &file.Provisioner{}, nil }, "file": func() (packersdk.Provisioner, error) { return &file.Provisioner{}, nil },
} }
} }

View File

@ -7,8 +7,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -20,7 +20,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -7,7 +7,6 @@ import (
"time" "time"
"github.com/hashicorp/hcl/v2/hcldec" "github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/config" "github.com/hashicorp/packer/packer-plugin-sdk/template/config"
) )
@ -16,7 +15,7 @@ type Provisioner struct {
Duration time.Duration Duration time.Duration
} }
var _ packer.Provisioner = new(Provisioner) var _ packersdk.Provisioner = new(Provisioner)
func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.FlatMapstructure().HCL2Spec() } func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec { return p.FlatMapstructure().HCL2Spec() }

View File

@ -7,7 +7,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
@ -18,7 +17,7 @@ func testConfig() map[string]interface{} {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }

View File

@ -9,7 +9,6 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps" "github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer" packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
) )
@ -49,7 +48,7 @@ func TestProvisionerPrepare_extractScript(t *testing.T) {
func TestProvisioner_Impl(t *testing.T) { func TestProvisioner_Impl(t *testing.T) {
var raw interface{} var raw interface{}
raw = &Provisioner{} raw = &Provisioner{}
if _, ok := raw.(packer.Provisioner); !ok { if _, ok := raw.(packersdk.Provisioner); !ok {
t.Fatalf("must be a Provisioner") t.Fatalf("must be a Provisioner")
} }
} }