Merge pull request #10218 from hashicorp/clean_plugin_sdk
Clean plugin sdk
This commit is contained in:
commit
efc117fb55
|
@ -14,10 +14,10 @@ import (
|
|||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/chroot"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/hcl2template"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
|
@ -372,7 +372,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
state.Put("wrappedCommand", common.CommandWrapper(wrappedCommand))
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
// Build the steps
|
||||
steps := []multistep.Step{
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
|
@ -31,7 +31,7 @@ type StepMountDevice struct {
|
|||
MountPartition string
|
||||
|
||||
mountPath string
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *StepMountDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -6,14 +6,14 @@ import (
|
|||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
// StepPrepareDevice finds an available device and sets it.
|
||||
type StepPrepareDevice struct {
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *StepPrepareDevice) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -3,7 +3,7 @@ package common
|
|||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
|
@ -17,7 +17,7 @@ type BuildInfoTemplate struct {
|
|||
SourceAMITags map[string]string
|
||||
}
|
||||
|
||||
func extractBuildInfo(region string, state multistep.StateBag, generatedData *builder.GeneratedData) *BuildInfoTemplate {
|
||||
func extractBuildInfo(region string, state multistep.StateBag, generatedData *packerbuilderdata.GeneratedData) *BuildInfoTemplate {
|
||||
rawSourceAMI, hasSourceAMI := state.GetOk("source_image")
|
||||
if !hasSourceAMI {
|
||||
return &BuildInfoTemplate{
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
|
@ -35,8 +35,8 @@ func testState() multistep.StateBag {
|
|||
return state
|
||||
}
|
||||
|
||||
func testGeneratedData(state multistep.StateBag) builder.GeneratedData {
|
||||
generatedData := builder.GeneratedData{State: state}
|
||||
func testGeneratedData(state multistep.StateBag) packerbuilderdata.GeneratedData {
|
||||
generatedData := packerbuilderdata.GeneratedData{State: state}
|
||||
return generatedData
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/aws/aws-sdk-go/service/ssm/ssmiface"
|
||||
"github.com/hashicorp/packer/builder/amazon/common/awserrors"
|
||||
"github.com/hashicorp/packer/common/retry"
|
||||
"github.com/hashicorp/packer/helper/builder/localexec"
|
||||
"github.com/hashicorp/packer/common/shell-local/localexec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
|
@ -22,7 +22,7 @@ type StepModifyAMIAttributes struct {
|
|||
Description string
|
||||
Ctx interpolate.Context
|
||||
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *StepModifyAMIAttributes) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
|
@ -13,7 +13,7 @@ import (
|
|||
// },
|
||||
|
||||
type StepSetGeneratedData struct {
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *StepSetGeneratedData) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
|
@ -23,7 +23,7 @@ func (t EC2Tags) Report(ui packer.Ui) {
|
|||
|
||||
func (t TagMap) EC2Tags(ictx interpolate.Context, region string, state multistep.StateBag) (EC2Tags, error) {
|
||||
var ec2Tags []*ec2.Tag
|
||||
generatedData := builder.GeneratedData{State: state}
|
||||
generatedData := packerbuilderdata.GeneratedData{State: state}
|
||||
ictx.Data = extractBuildInfo(region, state, &generatedData)
|
||||
|
||||
for key, value := range t {
|
||||
|
|
|
@ -15,9 +15,9 @@ import (
|
|||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/hcl2template"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
|
@ -169,7 +169,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("awsSession", session)
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
var instanceStep multistep.Step
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import (
|
|||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/hcl2template"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
|
@ -192,7 +192,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("awsSession", session)
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
var instanceStep multistep.Step
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/hcl2template"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
|
@ -180,7 +180,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("iam", iam)
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
var instanceStep multistep.Step
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ import (
|
|||
"github.com/aws/aws-sdk-go/service/ec2"
|
||||
"github.com/aws/aws-sdk-go/service/iam"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
awscommon "github.com/hashicorp/packer/builder/amazon/common"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
|
@ -250,7 +250,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("awsSession", session)
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
var instanceStep multistep.Step
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
|
@ -52,7 +52,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("config", &b.config)
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
// Setup the driver that will talk to Docker
|
||||
state.Put("driver", driver)
|
||||
|
|
|
@ -3,7 +3,7 @@ package docker
|
|||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/hashicorp/packer/helper/builder/localexec"
|
||||
"github.com/hashicorp/packer/common/shell-local/localexec"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@ package docker
|
|||
import (
|
||||
"context"
|
||||
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
type StepSetGeneratedData struct {
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *StepSetGeneratedData) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -4,14 +4,14 @@ import (
|
|||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
)
|
||||
|
||||
func TestStepSetGeneratedData_Run(t *testing.T) {
|
||||
state := testState(t)
|
||||
step := new(StepSetGeneratedData)
|
||||
step.GeneratedData = &builder.GeneratedData{State: state}
|
||||
step.GeneratedData = &packerbuilderdata.GeneratedData{State: state}
|
||||
driver := state.Get("driver").(*MockDriver)
|
||||
driver.Sha256Result = "80B3BB1B1696E73A9B19DEEF92F664F8979F948DF348088B61F9A3477655AF64"
|
||||
state.Put("image_id", "12345")
|
||||
|
@ -33,7 +33,7 @@ func TestStepSetGeneratedData_Run(t *testing.T) {
|
|||
|
||||
// Image ID not implement
|
||||
state = testState(t)
|
||||
step.GeneratedData = &builder.GeneratedData{State: state}
|
||||
step.GeneratedData = &packerbuilderdata.GeneratedData{State: state}
|
||||
driver = state.Get("driver").(*MockDriver)
|
||||
notImplementedMsg := "ERR_IMAGE_SHA256_NOT_FOUND"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/net"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ func (s *stepSetISO) Run(ctx context.Context, state multistep.StateBag) multiste
|
|||
|
||||
req.Header.Set("User-Agent", "Packer")
|
||||
|
||||
httpClient := commonhelper.HttpClientWithEnvironmentProxy()
|
||||
httpClient := net.HttpClientWithEnvironmentProxy()
|
||||
|
||||
res, err := httpClient.Do(req)
|
||||
if err == nil && (res.StatusCode >= 200 && res.StatusCode < 300) {
|
||||
|
|
|
@ -6,8 +6,8 @@ import (
|
|||
|
||||
"github.com/google/uuid"
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/communicator"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
|
@ -64,7 +64,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
|
|||
state.Put("sdk", driver.SDK())
|
||||
state.Put("hook", hook)
|
||||
state.Put("ui", ui)
|
||||
generatedData := &builder.GeneratedData{State: state}
|
||||
generatedData := &packerbuilderdata.GeneratedData{State: state}
|
||||
|
||||
// Build the steps
|
||||
steps := []multistep.Step{
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
|
||||
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
type stepCreateImage struct {
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func (s *stepCreateImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"io/ioutil"
|
||||
|
||||
"github.com/c2h5oh/datasize"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/common/uuid"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
|
@ -23,7 +23,7 @@ type StepCreateInstance struct {
|
|||
Debug bool
|
||||
SerialLogFile string
|
||||
|
||||
GeneratedData *builder.GeneratedData
|
||||
GeneratedData *packerbuilderdata.GeneratedData
|
||||
}
|
||||
|
||||
func createNetwork(ctx context.Context, c *Config, d Driver) (*vpc.Network, error) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package common
|
||||
package net
|
||||
|
||||
import (
|
||||
"net/http"
|
|
@ -1,7 +1,12 @@
|
|||
package builder
|
||||
package packerbuilderdata
|
||||
|
||||
import "github.com/hashicorp/packer/helper/multistep"
|
||||
|
||||
// This is used in the BasicPlaceholderData() func in the packer/provisioner.go
|
||||
// To force users to access generated data via the "generated" func.
|
||||
const PlaceholderMsg = "To set this dynamically in the Packer template, " +
|
||||
"you must use the `build` function"
|
||||
|
||||
// GeneratedData manages variables exported by a builder after
|
||||
// it started. It uses the builder's multistep.StateBag internally, make sure it
|
||||
// is not nil before calling any functions.
|
|
@ -1,4 +1,4 @@
|
|||
package builder
|
||||
package packerbuilderdata
|
||||
|
||||
import (
|
||||
"testing"
|
|
@ -14,6 +14,10 @@ import (
|
|||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
// RunAndStream allows you to run a local command and stream output to the UI.
|
||||
// This does not require use of a shell-local communicator, so is a nice tool
|
||||
// for plugins that need to shell out to a local dependency and provide clear
|
||||
// output to users.
|
||||
func RunAndStream(cmd *exec.Cmd, ui packer.Ui, sensitive []string) error {
|
||||
stdout_r, stdout_w := io.Pipe()
|
||||
stderr_r, stderr_w := io.Pipe()
|
|
@ -11,7 +11,7 @@ import (
|
|||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/packer/helper/builder/localexec"
|
||||
"github.com/hashicorp/packer/common/shell-local/localexec"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
"github.com/hashicorp/packer/packer/tmp"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
package common
|
||||
|
||||
// This is used in the BasicPlaceholderData() func in the packer/provisioner.go
|
||||
// To force users to access generated data via the "generated" func.
|
||||
const PlaceholderMsg = "To set this dynamically in the Packer template, " +
|
||||
"you must use the `build` function"
|
|
@ -6,7 +6,7 @@ import (
|
|||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -182,7 +182,7 @@ func (b *CoreBuild) Prepare() (warn []string, err error) {
|
|||
if generatedVars != nil {
|
||||
for _, k := range generatedVars {
|
||||
generatedPlaceholderMap[k] = fmt.Sprintf("Build_%s. "+
|
||||
common.PlaceholderMsg, k)
|
||||
packerbuilderdata.PlaceholderMsg, k)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
)
|
||||
|
||||
func boolPointer(tf bool) *bool {
|
||||
|
@ -214,7 +214,7 @@ func TestBuildPrepare_ProvisionerGetsGeneratedMap(t *testing.T) {
|
|||
}
|
||||
|
||||
generated := BasicPlaceholderData()
|
||||
generated["PartyVar"] = "Build_PartyVar. " + common.PlaceholderMsg
|
||||
generated["PartyVar"] = "Build_PartyVar. " + packerbuilderdata.PlaceholderMsg
|
||||
if !reflect.DeepEqual(prov.PrepConfigs, []interface{}{42, packerConfig, generated}) {
|
||||
t.Fatalf("bad: %#v", prov.PrepConfigs)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
)
|
||||
|
||||
// A provisioner is responsible for installing and configuring software
|
||||
|
@ -79,7 +79,7 @@ var BuilderDataCommonKeys = []string{
|
|||
func BasicPlaceholderData() map[string]string {
|
||||
placeholderData := map[string]string{}
|
||||
for _, key := range BuilderDataCommonKeys {
|
||||
placeholderData[key] = fmt.Sprintf("Build_%s. "+common.PlaceholderMsg, key)
|
||||
placeholderData[key] = fmt.Sprintf("Build_%s. "+packerbuilderdata.PlaceholderMsg, key)
|
||||
}
|
||||
|
||||
// Backwards-compatability: WinRM Password can get through without forcing
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
"os"
|
||||
"strings"
|
||||
|
||||
commonhelper "github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/net"
|
||||
)
|
||||
|
||||
type VagrantCloudClient struct {
|
||||
|
@ -48,7 +48,7 @@ func (v VagrantCloudErrors) FormatErrors() string {
|
|||
|
||||
func (v VagrantCloudClient) New(baseUrl string, token string, InsecureSkipTLSVerify bool) (*VagrantCloudClient, error) {
|
||||
c := &VagrantCloudClient{
|
||||
client: commonhelper.HttpClientWithEnvironmentProxy(),
|
||||
client: net.HttpClientWithEnvironmentProxy(),
|
||||
BaseURL: baseUrl,
|
||||
AccessToken: token,
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/hcl/v2/hcldec"
|
||||
"github.com/hashicorp/packer/builder"
|
||||
"github.com/hashicorp/packer/builder/yandex"
|
||||
"github.com/hashicorp/packer/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/helper/config"
|
||||
"github.com/hashicorp/packer/helper/multistep"
|
||||
"github.com/hashicorp/packer/packer"
|
||||
|
@ -210,7 +210,7 @@ func (p *PostProcessor) PostProcess(ctx context.Context, ui packer.Ui, artifact
|
|||
},
|
||||
&yandex.StepCreateInstance{
|
||||
Debug: p.config.PackerDebug,
|
||||
GeneratedData: &builder.GeneratedData{State: state},
|
||||
GeneratedData: &packerbuilderdata.GeneratedData{State: state},
|
||||
},
|
||||
new(yandex.StepWaitCloudInitScript),
|
||||
new(yandex.StepTeardownInstance),
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
"text/template"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
commontpl "github.com/hashicorp/packer/common/template"
|
||||
"github.com/hashicorp/packer/common/uuid"
|
||||
"github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/version"
|
||||
strftime "github.com/jehiah/go-strftime"
|
||||
)
|
||||
|
@ -170,7 +170,7 @@ func passthroughOrInterpolate(data map[interface{}]interface{}, s string) (strin
|
|||
// If we're in the first interpolation pass, the goal is to
|
||||
// make sure that we pass the value through.
|
||||
// TODO match against an actual string constant
|
||||
if strings.Contains(hp, common.PlaceholderMsg) {
|
||||
if strings.Contains(hp, packerbuilderdata.PlaceholderMsg) {
|
||||
return fmt.Sprintf("{{.%s}}", s), nil
|
||||
} else {
|
||||
return hp, nil
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/hashicorp/packer/helper/common"
|
||||
"github.com/hashicorp/packer/common/packerbuilderdata"
|
||||
"github.com/hashicorp/packer/version"
|
||||
)
|
||||
|
||||
|
@ -351,7 +351,7 @@ func TestFuncPackerBuild(t *testing.T) {
|
|||
},
|
||||
// Data map is a map[string]string and contains value with placeholder.
|
||||
{
|
||||
DataMap: map[string]string{"PartyVar": "PartyVal" + common.PlaceholderMsg},
|
||||
DataMap: map[string]string{"PartyVar": "PartyVal" + packerbuilderdata.PlaceholderMsg},
|
||||
ErrExpected: false,
|
||||
Template: "{{ build `PartyVar` }}",
|
||||
OutVal: "{{.PartyVar}}",
|
||||
|
@ -372,14 +372,14 @@ func TestFuncPackerBuild(t *testing.T) {
|
|||
},
|
||||
// Data map is a map[interface{}]interface{} and contains value with placeholder.
|
||||
{
|
||||
DataMap: map[interface{}]interface{}{"PartyVar": "PartyVal" + common.PlaceholderMsg},
|
||||
DataMap: map[interface{}]interface{}{"PartyVar": "PartyVal" + packerbuilderdata.PlaceholderMsg},
|
||||
ErrExpected: false,
|
||||
Template: "{{ build `PartyVar` }}",
|
||||
OutVal: "{{.PartyVar}}",
|
||||
},
|
||||
// Data map is a map[interface{}]interface{} and doesn't have value.
|
||||
{
|
||||
DataMap: map[interface{}]interface{}{"BadVar": "PartyVal" + common.PlaceholderMsg},
|
||||
DataMap: map[interface{}]interface{}{"BadVar": "PartyVal" + packerbuilderdata.PlaceholderMsg},
|
||||
ErrExpected: true,
|
||||
Template: "{{ build `MissingVar` }}",
|
||||
OutVal: "",
|
||||
|
|
Loading…
Reference in New Issue