Move hook and communicator definitions to packer-plugin-sdk

This commit is contained in:
Megan Marsh 2020-11-19 15:10:00 -08:00
parent a6fdeca099
commit 56a45b04ab
163 changed files with 443 additions and 623 deletions

View File

@ -10,7 +10,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -81,7 +80,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
client, err := b.config.Client()
if err != nil {

View File

@ -15,7 +15,6 @@ import (
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/hcl/v2/hcldec"
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/chroot"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -346,7 +345,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return generatedData, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
if runtime.GOOS != "linux" {
return nil, errors.New("The amazon-chroot builder only works on Linux environments.")
}

View File

@ -17,7 +17,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -151,7 +150,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return generatedData, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
session, err := b.config.Session()
if err != nil {

View File

@ -15,7 +15,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -174,7 +173,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return generatedData, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
session, err := b.config.Session()
if err != nil {
return nil, err

View File

@ -14,7 +14,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -165,7 +164,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return generatedData, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
session, err := b.config.Session()
if err != nil {
return nil, err

View File

@ -17,7 +17,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
awscommon "github.com/hashicorp/packer/builder/amazon/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -234,7 +233,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return generatedData, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
session, err := b.config.Session()
if err != nil {
return nil, err

View File

@ -5,7 +5,6 @@ import (
"fmt"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -26,7 +25,7 @@ type StepBundleVolume struct {
}
func (s *StepBundleVolume) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
config := state.Get("config").(*Config)
instance := state.Get("instance").(*ec2.Instance)
ui := state.Get("ui").(packersdk.Ui)
@ -53,7 +52,7 @@ func (s *StepBundleVolume) Run(ctx context.Context, state multistep.StateBag) mu
}
ui.Say("Bundling the volume...")
cmd := new(packer.RemoteCmd)
cmd := new(packersdk.RemoteCmd)
cmd.Command = config.BundleVolCommand
if s.Debug {

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -25,7 +24,7 @@ type StepUploadBundle struct {
}
func (s *StepUploadBundle) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
config := state.Get("config").(*Config)
manifestName := state.Get("manifest_name").(string)
manifestPath := state.Get("manifest_path").(string)
@ -64,7 +63,7 @@ func (s *StepUploadBundle) Run(ctx context.Context, state multistep.StateBag) mu
}
ui.Say("Uploading the bundle...")
cmd := &packer.RemoteCmd{Command: config.BundleUploadCommand}
cmd := &packersdk.RemoteCmd{Command: config.BundleUploadCommand}
if s.Debug {
ui.Say(fmt.Sprintf("Running: %s", config.BundleUploadCommand))

View File

@ -5,7 +5,6 @@ import (
"fmt"
"os"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -13,7 +12,7 @@ import (
type StepUploadX509Cert struct{}
func (s *StepUploadX509Cert) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packersdk.Ui)
@ -41,7 +40,7 @@ func (s *StepUploadX509Cert) Run(ctx context.Context, state multistep.StateBag)
func (s *StepUploadX509Cert) Cleanup(multistep.StateBag) {}
func (s *StepUploadX509Cert) uploadSingle(comm packer.Communicator, dst, src string) error {
func (s *StepUploadX509Cert) uploadSingle(comm packersdk.Communicator, dst, src string) error {
f, err := os.Open(src)
if err != nil {
return err

View File

@ -19,7 +19,6 @@ import (
"github.com/hashicorp/packer/builder/azure/common/constants"
"github.com/hashicorp/packer/builder/azure/common/lin"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -52,7 +51,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, errs
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
ui.Say("Running builder ...")

View File

@ -393,7 +393,7 @@ func checkHyperVGeneration(s string) interface{} {
s, compute.PossibleHyperVGenerationValues())
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
switch runtime.GOOS {
case "linux", "freebsd":
break

View File

@ -18,7 +18,6 @@ import (
"github.com/hashicorp/packer/builder/azure/common/constants"
"github.com/hashicorp/packer/builder/azure/common/lin"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -52,7 +51,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, errs
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
ui.Say("Running builder ...")

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}
// Run implements the packer.Builder interface.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
b.ui = ui
// Create a CloudStack API client.

View File

@ -12,7 +12,6 @@ import (
"github.com/digitalocean/godo"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -38,7 +37,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
client := godo.NewClient(oauth2.NewClient(context.TODO(), &apiTokenSource{
AccessToken: b.config.APIToken,
}))

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -36,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
driver := &DockerDriver{Ctx: &b.config.ctx, Ui: ui}
if err := driver.Verify(); err != nil {
return nil, err

View File

@ -15,7 +15,7 @@ import (
"syscall"
"github.com/hashicorp/go-version"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
type Communicator struct {
@ -29,9 +29,9 @@ type Communicator struct {
EntryPoint []string
}
var _ packer.Communicator = new(Communicator)
var _ packersdk.Communicator = new(Communicator)
func (c *Communicator) Start(ctx context.Context, remote *packer.RemoteCmd) error {
func (c *Communicator) Start(ctx context.Context, remote *packersdk.RemoteCmd) error {
dockerArgs := []string{
"exec",
"-i",
@ -274,7 +274,7 @@ func (c *Communicator) DownloadDir(src string, dst string, exclude []string) err
}
// Runs the given command and blocks until completion
func (c *Communicator) run(cmd *exec.Cmd, remote *packer.RemoteCmd, stdin io.WriteCloser, stdout, stderr io.ReadCloser) {
func (c *Communicator) run(cmd *exec.Cmd, remote *packersdk.RemoteCmd, stdin io.WriteCloser, stdout, stderr io.ReadCloser) {
// For Docker, remote communication must be serialized since it
// only supports single execution.
c.lock.Lock()

View File

@ -10,6 +10,7 @@ import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template"
"github.com/hashicorp/packer/provisioner/file"
"github.com/hashicorp/packer/provisioner/shell"
@ -60,10 +61,10 @@ func TestUploadDownload(t *testing.T) {
defer os.Remove("my-strawberry-cake")
// Add hooks so the provisioners run during the build
hooks := map[string][]packer.Hook{}
hooks[packer.HookProvision] = []packer.Hook{
hooks := map[string][]packersdk.Hook{}
hooks[packersdk.HookProvision] = []packersdk.Hook{
&packer.ProvisionHook{
Provisioners: []*packer.HookedProvisioner{
Provisioners: []*packersdk.HookedProvisioner{
{Provisioner: upload, Config: nil, TypeName: ""},
{Provisioner: download, Config: nil, TypeName: ""},
},
@ -148,10 +149,10 @@ func TestLargeDownload(t *testing.T) {
defer os.Remove("bigcake")
// Add hooks so the provisioners run during the build
hooks := map[string][]packer.Hook{}
hooks[packer.HookProvision] = []packer.Hook{
hooks := map[string][]packersdk.Hook{}
hooks[packersdk.HookProvision] = []packersdk.Hook{
&packer.ProvisionHook{
Provisioners: []*packer.HookedProvisioner{
Provisioners: []*packersdk.HookedProvisioner{
{Provisioner: shell, Config: nil, TypeName: ""},
{Provisioner: downloadCupcake, Config: nil, TypeName: ""},
{Provisioner: downloadBigcake, Config: nil, TypeName: ""},
@ -256,10 +257,10 @@ func TestFixUploadOwner(t *testing.T) {
}
// Add hooks so the provisioners run during the build
hooks := map[string][]packer.Hook{}
hooks[packer.HookProvision] = []packer.Hook{
hooks := map[string][]packersdk.Hook{}
hooks[packersdk.HookProvision] = []packersdk.Hook{
&packer.ProvisionHook{
Provisioners: []*packer.HookedProvisioner{
Provisioners: []*packersdk.HookedProvisioner{
{Provisioner: fileProvisioner, Config: nil, TypeName: ""},
{Provisioner: dirProvisioner, Config: nil, TypeName: ""},
{Provisioner: shellProvisioner, Config: nil, TypeName: ""},

View File

@ -10,7 +10,7 @@ import (
"os"
"path/filepath"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
// Windows containers are a special beast in Docker; you can't use docker cp
@ -46,7 +46,7 @@ func (c *WindowsContainerCommunicator) Upload(dst string, src io.Reader, fi *os.
// Copy the file into place by copying the temporary file we put
// into the shared folder into the proper location in the container
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: fmt.Sprintf("Copy-Item -Path %s/%s -Destination %s", c.ContainerDir,
filepath.Base(tempfile.Name()), dst),
}
@ -132,7 +132,7 @@ func (c *WindowsContainerCommunicator) UploadDir(dst string, src string, exclude
}
// Make the directory, then copy into it
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: fmt.Sprintf("Copy-Item %s -Destination %s -Recurse",
containerSrc, containerDst),
}
@ -156,7 +156,7 @@ func (c *WindowsContainerCommunicator) Download(src string, dst io.Writer) error
log.Printf("Downloading file from container: %s:%s", c.ContainerID, src)
// Copy file onto temp file on mounted volume inside container
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: fmt.Sprintf("Copy-Item -Path %s -Destination %s/%s", src, c.ContainerDir,
filepath.Base(src)),
Stdout: &stdout,

View File

@ -14,7 +14,6 @@ import (
"path/filepath"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -38,7 +37,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}
// Run is where the actual build should take place. It takes a Build and a Ui.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
artifact := new(FileArtifact)
// Create all directories leading to target
@ -81,7 +80,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (p
}
if hook != nil {
if err := hook.Run(ctx, packer.HookProvision, ui, new(packer.MockCommunicator), nil); err != nil {
if err := hook.Run(ctx, packersdk.HookProvision, ui, new(packersdk.MockCommunicator), nil); err != nil {
return nil, err
}
}

View File

@ -9,7 +9,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -36,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a googlecompute Packer build and returns a packersdk.Artifact
// representing a GCE machine image.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
cfg := GCEDriverConfig{
Ui: ui,
ProjectId: b.config.ProjectId,

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -35,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
opts := []hcloud.ClientOption{
hcloud.WithToken(b.config.HCloudToken),
hcloud.WithEndpoint(b.config.Endpoint),

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -52,7 +51,7 @@ type wrappedCommandTemplate struct {
Command string
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
wrappedCommand := func(command string) (string, error) {
ictx := b.config.ctx
ictx.Data = &wrappedCommandTemplate{Command: command}

View File

@ -8,7 +8,7 @@ import (
"path/filepath"
"strconv"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
type CommandWrapper func(string) (string, error)
@ -18,10 +18,10 @@ type CommandWrapper func(string) (string, error)
type ChrootCommunicator struct {
Chroot string
CmdWrapper CommandWrapper
Wrapped packer.Communicator
Wrapped packersdk.Communicator
}
func (c *ChrootCommunicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error {
func (c *ChrootCommunicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error {
command := strconv.Quote(cmd.Command)
chrootCommand, err := c.CmdWrapper(
fmt.Sprintf("sudo chroot %s /bin/sh -c %s", c.Chroot, command))

View File

@ -3,9 +3,9 @@ package hyperone
import (
"context"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
type stepChrootProvision struct{}
@ -13,7 +13,7 @@ type stepChrootProvision struct{}
func (s *stepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
config := state.Get("config").(*Config)
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
sshCommunicator := state.Get("communicator").(packer.Communicator)
sshCommunicator := state.Get("communicator").(packersdk.Communicator)
comm := &ChrootCommunicator{
Chroot: config.ChrootMountPath,

View File

@ -7,7 +7,6 @@ import (
"log"
"strings"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -27,7 +26,7 @@ func runCommands(commands []string, ictx interpolate.Context, state multistep.St
ctx := context.TODO()
ui := state.Get("ui").(packersdk.Ui)
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
for _, rawCmd := range commands {
intCmd, err := interpolate.Render(rawCmd, &ictx)
@ -40,7 +39,7 @@ func runCommands(commands []string, ictx interpolate.Context, state multistep.St
return fmt.Errorf("error wrapping command: %s", err)
}
remoteCmd := &packer.RemoteCmd{
remoteCmd := &packersdk.RemoteCmd{
Command: command,
}
@ -63,10 +62,10 @@ func runCommands(commands []string, ictx interpolate.Context, state multistep.St
func captureOutput(command string, state multistep.StateBag) (string, error) {
ctx := context.TODO()
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
var stdout bytes.Buffer
remoteCmd := &packer.RemoteCmd{
remoteCmd := &packersdk.RemoteCmd{
Command: command,
Stdout: &stdout,
}

View File

@ -8,7 +8,6 @@ import (
"log"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -17,7 +16,7 @@ import (
// but ultimately forcefully shuts it down if that fails.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// driver Driver
// ui packersdk.Ui
// vmName string
@ -31,7 +30,7 @@ type StepShutdown struct {
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)
vmName := state.Get("vmName").(string)
@ -41,7 +40,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
log.Printf("Executing shutdown command: %s", s.Command)
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: s.Command,
Stdout: &stdout,
Stderr: &stderr,

View File

@ -14,7 +14,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
hypervcommon "github.com/hashicorp/packer/builder/hyperv/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/bootcommand"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -177,7 +176,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a Hyperv appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with Hyperv
driver, err := hypervcommon.NewHypervPS4Driver()
if err != nil {

View File

@ -14,7 +14,6 @@ import (
hypervcommon "github.com/hashicorp/packer/builder/hyperv/common"
powershell "github.com/hashicorp/packer/builder/hyperv/common/powershell"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/bootcommand"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -217,7 +216,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a Hyperv appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with Hyperv
driver, err := hypervcommon.NewHypervPS4Driver()
if err != nil {

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -43,7 +42,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("hook", hook)

View File

@ -12,7 +12,6 @@ import (
"github.com/linode/linodego"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -37,7 +36,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (ret packersdk.Artifact, err error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (ret packersdk.Artifact, err error) {
ui.Say("Running builder ...")
client := newLinodeClient(b.config.PersonalAccessToken)

View File

@ -6,7 +6,6 @@ import (
"path/filepath"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -36,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
wrappedCommand := func(command string) (string, error) {
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)

View File

@ -12,7 +12,7 @@ import (
"strings"
"syscall"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/tmp"
)
@ -23,7 +23,7 @@ type LxcAttachCommunicator struct {
CmdWrapper CommandWrapper
}
func (c *LxcAttachCommunicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error {
func (c *LxcAttachCommunicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error {
localCmd, err := c.Execute(cmd.Command)
if err != nil {

View File

@ -3,13 +3,13 @@ package lxc
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestCommunicator_ImplementsCommunicator(t *testing.T) {
var raw interface{}
raw = &LxcAttachCommunicator{}
if _, ok := raw.(packer.Communicator); !ok {
if _, ok := raw.(packersdk.Communicator); !ok {
t.Fatalf("Communicator should be a communicator")
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -14,7 +13,7 @@ import (
type StepProvision struct{}
func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
hook := state.Get("hook").(packer.Hook)
hook := state.Get("hook").(packersdk.Hook)
config := state.Get("config").(*Config)
mountPath := state.Get("mount_path").(string)
ui := state.Get("ui").(packersdk.Ui)
@ -37,7 +36,7 @@ func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multi
// Provision
log.Println("Running the provision hook")
if err := hook.Run(ctx, packer.HookProvision, ui, comm, hookData); err != nil {
if err := hook.Run(ctx, packersdk.HookProvision, ui, comm, hookData); err != nil {
state.Put("error", err)
return multistep.ActionHalt
}

View File

@ -4,7 +4,6 @@ import (
"context"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
wrappedCommand := func(command string) (string, error) {
b.config.ctx.Data = &wrappedCommandTemplate{Command: command}
return interpolate.Render(b.config.CommandWrapper, &b.config.ctx)

View File

@ -10,7 +10,7 @@ import (
"path/filepath"
"syscall"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
type Communicator struct {
@ -18,7 +18,7 @@ type Communicator struct {
CmdWrapper CommandWrapper
}
func (c *Communicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error {
func (c *Communicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error {
localCmd, err := c.Execute(cmd.Command)
if err != nil {
@ -61,7 +61,7 @@ func (c *Communicator) Upload(dst string, r io.Reader, fi *os.FileInfo) error {
fileDestination := filepath.Join(c.ContainerName, dst)
// find out if the place we are pushing to is a directory
testDirectoryCommand := fmt.Sprintf(`test -d "%s"`, dst)
cmd := &packer.RemoteCmd{Command: testDirectoryCommand}
cmd := &packersdk.RemoteCmd{Command: testDirectoryCommand}
err := c.Start(ctx, cmd)
if err != nil {

View File

@ -3,13 +3,13 @@ package lxd
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestCommunicator_ImplementsCommunicator(t *testing.T) {
var raw interface{}
raw = &Communicator{}
if _, ok := raw.(packer.Communicator); !ok {
if _, ok := raw.(packersdk.Communicator); !ok {
t.Fatalf("Communicator should be a communicator")
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -14,7 +13,7 @@ import (
type StepProvision struct{}
func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
hook := state.Get("hook").(packer.Hook)
hook := state.Get("hook").(packersdk.Hook)
config := state.Get("config").(*Config)
ui := state.Get("ui").(packersdk.Ui)
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
@ -34,7 +33,7 @@ func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multi
// Provision
log.Println("Running the provision hook")
if err := hook.Run(ctx, packer.HookProvision, ui, comm, hookData); err != nil {
if err := hook.Run(ctx, packersdk.HookProvision, ui, comm, hookData); err != nil {
state.Put("error", err)
return multistep.ActionHalt
}

View File

@ -6,7 +6,6 @@ import (
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -32,7 +31,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
ui.Message("Creating Naver Cloud Platform Connection ...")
config := Config{
AccessKey: b.config.AccessKey,

View File

@ -5,7 +5,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -29,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
steps := []multistep.Step{}
steps = append(steps,

View File

@ -7,7 +7,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -31,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)

View File

@ -11,7 +11,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -73,7 +72,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
if b.config.PackerDebug {
b.config.enableDebug(ui)
}

View File

@ -13,7 +13,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
ocommon "github.com/hashicorp/packer/builder/oracle/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -46,7 +45,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
loggingEnabled := os.Getenv("PACKER_OCI_CLASSIC_LOGGING") != ""
httpClient := cleanhttp.DefaultClient()
config := &opc.Config{

View File

@ -6,7 +6,6 @@ import (
"log"
"strings"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -27,7 +26,7 @@ type uploadCmdData struct {
func (s *stepUploadImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packersdk.Ui)
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
config := state.Get("config").(*Config)
runID := state.Get("run_id").(string)
@ -64,7 +63,7 @@ func (s *stepUploadImage) Run(ctx context.Context, state multistep.StateBag) mul
dest := "/tmp/create-packer-diskimage.sh"
comm.Upload(dest, strings.NewReader(command), nil)
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: fmt.Sprintf("sudo /bin/sh %s", dest),
}
if err := cmd.RunWithUi(ctx, comm, ui); err != nil {

View File

@ -9,7 +9,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
ocommon "github.com/hashicorp/packer/builder/oracle/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -39,7 +38,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
driver, err := NewDriverOCI(&b.config)
if err != nil {
return nil, err

View File

@ -14,7 +14,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
osccommon "github.com/hashicorp/packer/builder/osc/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -85,7 +84,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
oscConn := b.config.NewOSCClient()
// Setup the state bag and initial state for the steps

View File

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
osccommon "github.com/hashicorp/packer/builder/osc/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -103,7 +102,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
oscConn := b.config.NewOSCClient()
// Setup the state bag and initial state for the steps

View File

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
osccommon "github.com/hashicorp/packer/builder/osc/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -88,7 +87,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// clientConfig, err := b.config.Config()
// if err != nil {
// return nil, err

View File

@ -13,7 +13,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
osccommon "github.com/hashicorp/packer/builder/osc/common"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -188,7 +187,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warns, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
if runtime.GOOS != "linux" {
return nil, errors.New("The outscale-chroot builder only works on Linux environments.")
}

View File

@ -13,7 +13,7 @@ import (
"strings"
"syscall"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/tmp"
)
@ -24,7 +24,7 @@ type Communicator struct {
CmdWrapper CommandWrapper
}
func (c *Communicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error {
func (c *Communicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error {
// need extra escapes for the command since we're wrapping it in quotes
cmd.Command = strconv.Quote(cmd.Command)
command, err := c.CmdWrapper(

View File

@ -3,13 +3,13 @@ package chroot
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestCommunicator_ImplementsCommunicator(t *testing.T) {
var raw interface{}
raw = &Communicator{}
if _, ok := raw.(packer.Communicator); !ok {
if _, ok := raw.(packersdk.Communicator); !ok {
t.Fatalf("Communicator should be a communicator")
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -27,7 +26,7 @@ func RunLocalCommands(commands []string, wrappedCommand CommandWrapper, ictx int
comm := &sl.Communicator{
ExecuteCommand: []string{"sh", "-c", command},
}
cmd := &packer.RemoteCmd{Command: command}
cmd := &packersdk.RemoteCmd{Command: command}
if err := cmd.RunWithUi(ctx, comm, ui); err != nil {
return fmt.Errorf("Error executing command: %s", err)
}

View File

@ -4,7 +4,6 @@ import (
"context"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -15,7 +14,7 @@ type StepChrootProvision struct {
}
func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
hook := state.Get("hook").(packer.Hook)
hook := state.Get("hook").(packersdk.Hook)
mountPath := state.Get("mount_path").(string)
ui := state.Get("ui").(packersdk.Ui)
wrappedCommand := state.Get("wrappedCommand").(CommandWrapper)
@ -35,7 +34,7 @@ func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag)
// Provision
log.Println("Running the provision hook")
if err := hook.Run(ctx, packer.HookProvision, ui, comm, hookData); err != nil {
if err := hook.Run(ctx, packersdk.HookProvision, ui, comm, hookData); err != nil {
state.Put("error", err)
return multistep.ActionHalt
}

View File

@ -8,7 +8,6 @@ import (
"log"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -17,7 +16,7 @@ import (
// so gracefully, but ultimately forcefully shuts it down if that fails.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// driver Driver
// ui packersdk.Ui
// vmName string
@ -31,7 +30,7 @@ type StepShutdown struct {
// Run shuts down the VM.
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)
vmName := state.Get("vmName").(string)
@ -41,7 +40,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
log.Printf("Executing shutdown command: %s", s.Command)
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: s.Command,
Stdout: &stdout,
Stderr: &stderr,

View File

@ -6,7 +6,6 @@ import (
"log"
"os"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -15,7 +14,7 @@ import (
// This step uploads the Parallels Tools ISO to the virtual machine.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// parallels_tools_path string
// ui packersdk.Ui
//
@ -28,7 +27,7 @@ type toolsPathTemplate struct {
// to the VM.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// parallels_tools_path string
// ui packersdk.Ui
type StepUploadParallelsTools struct {
@ -40,7 +39,7 @@ type StepUploadParallelsTools struct {
// Run uploads the Parallels Tools ISO to the VM.
func (s *StepUploadParallelsTools) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
ui := state.Get("ui").(packersdk.Ui)
// If we're attaching then don't do this, since we attached.

View File

@ -6,7 +6,6 @@ import (
"fmt"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -15,7 +14,7 @@ import (
// Parallels Desktop, which can be useful for various provisioning reasons.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// driver Driver
// ui packersdk.Ui
type StepUploadVersion struct {
@ -24,7 +23,7 @@ type StepUploadVersion struct {
// Run uploads a file containing the version of Parallels Desktop.
func (s *StepUploadVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)

View File

@ -11,7 +11,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
parallelscommon "github.com/hashicorp/packer/builder/parallels/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/bootcommand"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -181,7 +180,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with Parallels
driver, err := parallelscommon.NewDriver()
if err != nil {

View File

@ -8,7 +8,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
parallelscommon "github.com/hashicorp/packer/builder/parallels/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a Parallels appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with Parallels
driver, err := parallelscommon.NewDriver()
if err != nil {

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -30,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("config", &b.config)

View File

@ -28,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return b.config.Prepare(raws...)
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("clone-config", &b.config)

View File

@ -8,7 +8,6 @@ import (
"github.com/Telmate/proxmox-api-go/proxmox"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ type Builder struct {
vmCreator ProxmoxVMCreator
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook, state multistep.StateBag) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook, state multistep.StateBag) (packersdk.Artifact, error) {
var err error
tlsConfig := &tls.Config{
InsecureSkipVerify: b.config.SkipCertValidation,

View File

@ -30,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
const downloadPathKey = "downloaded_iso_path"
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("iso-config", &b.config)

View File

@ -11,7 +11,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -35,7 +34,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with Qemu
driver, err := b.newDriver(b.config.QemuBinary)
if err != nil {

View File

@ -8,7 +8,6 @@ import (
"time"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -17,7 +16,7 @@ import (
// but ultimately forcefully shuts it down if that fails.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// config *config
// driver Driver
// ui packersdk.Ui
@ -53,10 +52,10 @@ func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
}
if s.ShutdownCommand != "" {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
ui.Say("Gracefully halting virtual machine...")
log.Printf("Executing shutdown command: %s", s.ShutdownCommand)
cmd := &packer.RemoteCmd{Command: s.ShutdownCommand}
cmd := &packersdk.RemoteCmd{Command: s.ShutdownCommand}
if err := cmd.RunWithUi(ctx, comm, ui); err != nil {
err := fmt.Errorf("Failed to send shutdown command: %s", err)
state.Put("error", err)

View File

@ -10,7 +10,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -36,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
scwZone, err := scw.ParseZone(b.config.Zone)
if err != nil {
ui.Error(err.Error())

View File

@ -8,7 +8,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -65,7 +64,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
cvmClient, vpcClient, err := b.config.Client()
if err != nil {
return nil, err

View File

@ -6,7 +6,6 @@ import (
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -50,7 +49,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, errs.ErrorOrNil()
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
config := b.config
driver, err := NewDriverTriton(ui, config)

View File

@ -10,7 +10,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
ucloudcommon "github.com/hashicorp/packer/builder/ucloud/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -68,7 +67,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, nil, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
client, err := b.config.Client()
if err != nil {

View File

@ -15,7 +15,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/bootcommand"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -274,7 +273,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a VirtualBox appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with VirtualBox
VagrantCWD, err := filepath.Abs(b.config.OutputDir)
if err != nil {

View File

@ -7,7 +7,6 @@ import (
"log"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -16,7 +15,7 @@ import (
// but ultimately forcefully shuts it down if that fails.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// driver Driver
// ui packersdk.Ui
// vmName string
@ -32,7 +31,7 @@ type StepShutdown struct {
}
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)
vmName := state.Get("vmName").(string)
@ -49,7 +48,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
if s.Command != "" {
ui.Say("Gracefully halting virtual machine...")
log.Printf("Executing shutdown command: %s", s.Command)
cmd := &packer.RemoteCmd{Command: s.Command}
cmd := &packersdk.RemoteCmd{Command: s.Command}
if err := cmd.RunWithUi(ctx, comm, ui); err != nil {
err := fmt.Errorf("Failed to send shutdown command: %s", err)
state.Put("error", err)

View File

@ -6,7 +6,6 @@ import (
"log"
"os"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -24,7 +23,7 @@ type StepUploadGuestAdditions struct {
}
func (s *StepUploadGuestAdditions) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)

View File

@ -6,7 +6,6 @@ import (
"fmt"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -18,7 +17,7 @@ type StepUploadVersion struct {
}
func (s *StepUploadVersion) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)

View File

@ -11,7 +11,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/bootcommand"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
@ -231,7 +230,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with VirtualBox
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -8,7 +8,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a VirtualBox appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with VirtualBox
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -8,7 +8,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
vboxcommon "github.com/hashicorp/packer/builder/virtualbox/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -34,7 +33,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a VirtualBox appliance.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
// Create the driver that we'll use to communicate with VirtualBox
driver, err := vboxcommon.NewDriver()
if err != nil {

View File

@ -30,7 +30,6 @@ import (
"github.com/hashicorp/go-getter/v2"
"github.com/hashicorp/packer/helper/communicator"
helperssh "github.com/hashicorp/packer/helper/communicator/ssh"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/ssh"
@ -57,7 +56,7 @@ type ESX5Driver struct {
client *govmomi.Client
finder *find.Finder
comm packer.Communicator
comm packersdk.Communicator
outputDir string
vmId string
}
@ -865,7 +864,7 @@ func (d *ESX5Driver) ssh(command string, stdin io.Reader) (*bytes.Buffer, error)
ctx := context.TODO()
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: command,
Stdout: &stdout,
Stderr: &stderr,

View File

@ -10,7 +10,6 @@ import (
"strings"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -19,7 +18,7 @@ import (
// but ultimately forcefully shuts it down if that fails.
//
// Uses:
// communicator packer.Communicator
// communicator packersdk.Communicator
// dir OutputDir
// driver Driver
// ui packersdk.Ui
@ -36,7 +35,7 @@ type StepShutdown struct {
}
func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
dir := state.Get("dir").(OutputDir)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packersdk.Ui)
@ -47,7 +46,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
log.Printf("Executing shutdown command: %s", s.Command)
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: s.Command,
Stdout: &stdout,
Stderr: &stderr,

View File

@ -5,7 +5,6 @@ import (
"fmt"
"os"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -36,7 +35,7 @@ func (c *StepUploadTools) Run(ctx context.Context, state multistep.StateBag) mul
return multistep.ActionContinue
}
comm := state.Get("communicator").(packer.Communicator)
comm := state.Get("communicator").(packersdk.Communicator)
tools_source := state.Get("tools_upload_source").(string)
ui := state.Get("ui").(packersdk.Ui)

View File

@ -9,7 +9,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
vmwcommon "github.com/hashicorp/packer/builder/vmware/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -31,7 +30,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
if err != nil {
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)

View File

@ -16,6 +16,7 @@ import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/template"
"github.com/hashicorp/packer/provisioner/shell"
)
@ -140,7 +141,7 @@ func setupVMwareBuild(t *testing.T, builderConfig map[string]string, provisioner
BuilderStore: packer.MapOfBuilder{
"vmware-iso": func() (packer.Builder, error) { return &Builder{}, nil },
},
Hook: func(n string) (packer.Hook, error) {
Hook: func(n string) (packersdk.Hook, error) {
return &packer.DispatchHook{}, nil
},
ProvisionerStore: packer.MapOfProvisioner{

View File

@ -10,7 +10,6 @@ import (
"github.com/hashicorp/hcl/v2/hcldec"
vmwcommon "github.com/hashicorp/packer/builder/vmware/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -36,7 +35,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a Packer build and returns a packersdk.Artifact representing
// a VMware image.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
driver, err := vmwcommon.NewDriver(&b.config.DriverConfig, &b.config.SSHConfig, b.config.VMName)
if err != nil {
return nil, fmt.Errorf("Failed creating VMware driver: %s", err)

View File

@ -8,7 +8,6 @@ import (
"github.com/hashicorp/packer/builder/vsphere/common"
"github.com/hashicorp/packer/builder/vsphere/driver"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -30,7 +29,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("debug", b.config.PackerDebug)
state.Put("hook", hook)

View File

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/packer/builder/vsphere/driver"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
@ -62,7 +61,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
return multistep.ActionContinue
}
comm, _ := state.Get("communicator").(packer.Communicator)
comm, _ := state.Get("communicator").(packersdk.Communicator)
if comm == nil {
msg := fmt.Sprintf("Please shutdown virtual machine within %s.", s.Config.Timeout)
@ -77,7 +76,7 @@ func (s *StepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
log.Printf("Shutdown command: %s", s.Config.Command)
var stdout, stderr bytes.Buffer
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Command: s.Config.Command,
Stdout: &stdout,
Stderr: &stderr,

View File

@ -7,7 +7,6 @@ import (
"github.com/hashicorp/packer/builder/vsphere/common"
"github.com/hashicorp/packer/builder/vsphere/driver"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -29,7 +28,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
return nil, warnings, nil
}
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
state := new(multistep.BasicStateBag)
state.Put("debug", b.config.PackerDebug)
state.Put("hook", hook)

View File

@ -7,7 +7,6 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
@ -50,7 +49,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
// Run executes a yandex Packer build and returns a packersdk.Artifact
// representing a Yandex.Cloud compute image.
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
driver, err := NewDriverYC(ui, &b.config.AccessConfig)
ctx = requestid.ContextWithClientTraceID(ctx, uuid.New().String())

View File

@ -37,7 +37,7 @@ func (b *ParallelTestBuilder) Prepare(raws ...interface{}) ([]string, []string,
return nil, nil, nil
}
func (b *ParallelTestBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *ParallelTestBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
ui.Say("building")
b.wg.Done()
return nil, nil
@ -52,7 +52,7 @@ func (b *LockedBuilder) Prepare(raws ...interface{}) ([]string, []string, error)
return nil, nil, nil
}
func (b *LockedBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *LockedBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
ui.Say("locking build")
select {
case <-b.unlock:

View File

@ -14,6 +14,7 @@ import (
"github.com/hashicorp/packer/command"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer/plugin"
)
@ -187,8 +188,8 @@ func (c *config) StartBuilder(name string) (packer.Builder, error) {
}
// This is a proper implementation of packer.HookFunc that can be used
// to load packer.Hook implementations from the defined plugins.
func (c *config) StarHook(name string) (packer.Hook, error) {
// to load packersdk.Hook implementations from the defined plugins.
func (c *config) StarHook(name string) (packersdk.Hook, error) {
log.Printf("Loading hook: %s\n", name)
return c.pluginClient(name).Hook()
}

View File

@ -78,7 +78,7 @@ func (b *MockBuilder) Prepare(raws ...interface{}) ([]string, []string, error) {
return []string{"ID"}, nil, b.Config.Prepare(raws...)
}
func (b *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packer.Hook) (packersdk.Artifact, error) {
func (b *MockBuilder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook) (packersdk.Artifact, error) {
return nil, nil
}
@ -100,7 +100,7 @@ func (b *MockProvisioner) Prepare(raws ...interface{}) error {
return b.Config.Prepare(raws...)
}
func (b *MockProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packer.Communicator, _ map[string]interface{}) error {
func (b *MockProvisioner) Provision(ctx context.Context, ui packersdk.Ui, comm packersdk.Communicator, _ map[string]interface{}) error {
return nil
}
@ -132,10 +132,10 @@ func (b *MockPostProcessor) PostProcess(ctx context.Context, ui packersdk.Ui, a
type MockCommunicator struct {
Config MockConfig
packer.Communicator
packersdk.Communicator
}
var _ packer.ConfigurableCommunicator = new(MockCommunicator)
var _ packersdk.ConfigurableCommunicator = new(MockCommunicator)
func (b *MockCommunicator) ConfigSpec() hcldec.ObjectSpec {
return b.Config.FlatMapstructure().HCL2Spec()

View File

@ -67,7 +67,7 @@ func (p *HCL2Provisioner) Prepare(args ...interface{}) error {
return p.Provisioner.Prepare(args...)
}
func (p *HCL2Provisioner) Provision(ctx context.Context, ui packersdk.Ui, c packer.Communicator, vars map[string]interface{}) error {
func (p *HCL2Provisioner) Provision(ctx context.Context, ui packersdk.Ui, c packersdk.Communicator, vars map[string]interface{}) error {
err := p.HCL2Prepare(vars)
if err != nil {
return err

View File

@ -15,6 +15,7 @@ import (
helperssh "github.com/hashicorp/packer/helper/communicator/ssh"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
packerssh "github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/ssh"
"github.com/hashicorp/packer/packer-plugin-sdk/template/config"
"github.com/hashicorp/packer/packer-plugin-sdk/template/interpolate"
@ -257,8 +258,8 @@ func (c *WinRM) Configure(raws ...interface{}) ([]string, error) {
}
var (
_ packer.ConfigurableCommunicator = new(SSH)
_ packer.ConfigurableCommunicator = new(WinRM)
_ packersdk.ConfigurableCommunicator = new(SSH)
_ packersdk.ConfigurableCommunicator = new(WinRM)
)
type SSHInterface struct {

View File

@ -37,7 +37,7 @@ type StepConnectSSH struct {
func (s *StepConnectSSH) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packersdk.Ui)
var comm packer.Communicator
var comm packersdk.Communicator
var err error
subCtx, cancel := context.WithCancel(ctx)
@ -85,7 +85,7 @@ func (s *StepConnectSSH) Run(ctx context.Context, state multistep.StateBag) mult
func (s *StepConnectSSH) Cleanup(multistep.StateBag) {
}
func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, ctx context.Context) (packer.Communicator, error) {
func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, ctx context.Context) (packersdk.Communicator, error) {
// Determine if we're using a bastion host, and if so, retrieve
// that configuration. This configuration doesn't change so we
// do this one before entering the retry loop.
@ -118,7 +118,7 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, ctx context.Contex
handshakeAttempts := 0
var comm packer.Communicator
var comm packersdk.Communicator
first := true
for {
// Don't check for cancel or wait on first iteration

View File

@ -13,7 +13,6 @@ import (
"strings"
"time"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/sdk-internals/communicator/winrm"
@ -29,7 +28,7 @@ import (
// ui packersdk.Ui
//
// Produces:
// communicator packer.Communicator
// communicator packersdk.Communicator
type StepConnectWinRM struct {
// All the fields below are documented on StepConnect
Config *Config
@ -41,7 +40,7 @@ type StepConnectWinRM struct {
func (s *StepConnectWinRM) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
ui := state.Get("ui").(packersdk.Ui)
var comm packer.Communicator
var comm packersdk.Communicator
var err error
subCtx, cancel := context.WithCancel(ctx)
@ -88,8 +87,8 @@ func (s *StepConnectWinRM) Run(ctx context.Context, state multistep.StateBag) mu
func (s *StepConnectWinRM) Cleanup(multistep.StateBag) {
}
func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, ctx context.Context) (packer.Communicator, error) {
var comm packer.Communicator
func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, ctx context.Context) (packersdk.Communicator, error) {
var comm packersdk.Communicator
first := true
for {
// Don't check for cancel or wait on first iteration
@ -170,7 +169,7 @@ func (s *StepConnectWinRM) waitForWinRM(state multistep.StateBag, ctx context.Co
var retryableSleep = 5 * time.Second
// run an "echo" command to make sure that the winrm is connected
for {
cmd := &packer.RemoteCmd{Command: connectCheckCommand}
cmd := &packersdk.RemoteCmd{Command: connectCheckCommand}
var buf, buf2 bytes.Buffer
cmd.Stdout = &buf
cmd.Stdout = io.MultiWriter(cmd.Stdout, &buf2)

View File

@ -12,23 +12,22 @@ import (
"strings"
"github.com/google/shlex"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"golang.org/x/crypto/ssh"
)
// An adapter satisfies SSH requests (from an Ansible client) by delegating SSH
// exec and subsystem commands to a packer.Communicator.
// exec and subsystem commands to a packersdk.Communicator.
type Adapter struct {
done <-chan struct{}
l net.Listener
config *ssh.ServerConfig
sftpCmd string
ui packersdk.Ui
comm packer.Communicator
comm packersdk.Communicator
}
func NewAdapter(done <-chan struct{}, l net.Listener, config *ssh.ServerConfig, sftpCmd string, ui packersdk.Ui, comm packer.Communicator) *Adapter {
func NewAdapter(done <-chan struct{}, l net.Listener, config *ssh.ServerConfig, sftpCmd string, ui packersdk.Ui, comm packersdk.Communicator) *Adapter {
return &Adapter{
done: done,
l: l,
@ -229,7 +228,7 @@ func (c *Adapter) scpExec(args string, in io.Reader, out io.Writer) error {
}
func (c *Adapter) remoteExec(command string, in io.Reader, out io.Writer, err io.Writer) int {
cmd := &packer.RemoteCmd{
cmd := &packersdk.RemoteCmd{
Stdin: in,
Stdout: out,
Stderr: err,

View File

@ -11,6 +11,7 @@ import (
"time"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"golang.org/x/crypto/ssh"
)
@ -96,7 +97,7 @@ func (a addr) String() string {
type communicator struct{}
func (c communicator) Start(context.Context, *packer.RemoteCmd) error {
func (c communicator) Start(context.Context, *packersdk.RemoteCmd) error {
return errors.New("communicator not supported")
}

View File

@ -12,7 +12,7 @@ import (
"strings"
"time"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/tmp"
)
@ -36,7 +36,7 @@ well.
send a 0 byte after file contents.
*/
func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packer.Communicator) error {
func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packersdk.Communicator) error {
rest = strings.TrimSpace(rest)
if len(rest) == 0 {
fmt.Fprintf(out, scpEmptyError)
@ -61,7 +61,7 @@ func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, com
return state.Protocol(bufio.NewReader(in), out)
}
func scpDownloadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packer.Communicator) error {
func scpDownloadSession(opts []byte, rest string, in io.Reader, out io.Writer, comm packersdk.Communicator) error {
rest = strings.TrimSpace(rest)
if len(rest) == 0 {
fmt.Fprintf(out, scpEmptyError)
@ -121,7 +121,7 @@ func (state *scpDownloadState) FileProtocol(path string, info os.FileInfo, in *b
}
type scpUploadState struct {
comm packer.Communicator
comm packersdk.Communicator
target string // target is the directory on the target
srcRoot string // srcRoot is the directory on the host
mtime time.Time

View File

@ -13,8 +13,8 @@ import (
"strings"
"syscall"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/tmp"
)
@ -25,7 +25,7 @@ type Communicator struct {
CmdWrapper common.CommandWrapper
}
func (c *Communicator) Start(ctx context.Context, cmd *packer.RemoteCmd) error {
func (c *Communicator) Start(ctx context.Context, cmd *packersdk.RemoteCmd) error {
// need extra escapes for the command since we're wrapping it in quotes
cmd.Command = strconv.Quote(cmd.Command)
command, err := c.CmdWrapper(

View File

@ -3,13 +3,13 @@ package chroot
import (
"testing"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
)
func TestCommunicator_ImplementsCommunicator(t *testing.T) {
var raw interface{}
raw = &Communicator{}
if _, ok := raw.(packer.Communicator); !ok {
if _, ok := raw.(packersdk.Communicator); !ok {
t.Fatalf("Communicator should be a communicator")
}
}

View File

@ -4,7 +4,6 @@ import (
"context"
"fmt"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
sl "github.com/hashicorp/packer/packer-plugin-sdk/shell-local"
@ -28,7 +27,7 @@ func RunLocalCommands(commands []string, wrappedCommand common.CommandWrapper, i
comm := &sl.Communicator{
ExecuteCommand: []string{"sh", "-c", command},
}
cmd := &packer.RemoteCmd{Command: command}
cmd := &packersdk.RemoteCmd{Command: command}
if err := cmd.RunWithUi(ctx, comm, ui); err != nil {
return fmt.Errorf("Error executing command: %s", err)
}

View File

@ -4,7 +4,6 @@ import (
"context"
"log"
"github.com/hashicorp/packer/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/common"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep"
"github.com/hashicorp/packer/packer-plugin-sdk/multistep/commonsteps"
@ -16,7 +15,7 @@ type StepChrootProvision struct {
}
func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
hook := state.Get("hook").(packer.Hook)
hook := state.Get("hook").(packersdk.Hook)
mountPath := state.Get("mount_path").(string)
ui := state.Get("ui").(packersdk.Ui)
wrappedCommand := state.Get("wrappedCommand").(common.CommandWrapper)
@ -36,7 +35,7 @@ func (s *StepChrootProvision) Run(ctx context.Context, state multistep.StateBag)
// Provision
log.Println("Running the provision hook")
if err := hook.Run(ctx, packer.HookProvision, ui, comm, hookData); err != nil {
if err := hook.Run(ctx, packersdk.HookProvision, ui, comm, hookData); err != nil {
state.Put("error", err)
return multistep.ActionHalt
}

View File

@ -8,12 +8,12 @@ import (
"strings"
"text/template"
"github.com/hashicorp/packer/packer"
packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
"github.com/hashicorp/packer/packer-plugin-sdk/uuid"
)
type ElevatedProvisioner interface {
Communicator() packer.Communicator
Communicator() packersdk.Communicator
ElevatedUser() string
ElevatedPassword() string
}

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