gofmt project.

noticed many unrelated changes being added to patches because of gofmt.

ran `find . -not -path "./vendor/*" -name "*.go" -exec gofmt -w {} \;`
This commit is contained in:
Matthew Hooker 2016-09-29 14:13:04 -07:00
parent 1e4872303f
commit a8e57d83d2
17 changed files with 111 additions and 116 deletions

View File

@ -41,16 +41,16 @@ func (a *Artifact) String() string {
func (a *Artifact) State(name string) interface{} { func (a *Artifact) State(name string) interface{} {
switch name { switch name {
case "ImageName": case "ImageName":
return a.image.Name return a.image.Name
case "ImageSizeGb": case "ImageSizeGb":
return a.image.SizeGb return a.image.SizeGb
case "AccountFilePath": case "AccountFilePath":
return a.config.AccountFile return a.config.AccountFile
case "ProjectId": case "ProjectId":
return a.config.ProjectId return a.config.ProjectId
case "BuildZone": case "BuildZone":
return a.config.Zone return a.config.Zone
} }
return nil return nil
} }

View File

@ -31,7 +31,7 @@ type Driver interface {
// GetNatIP gets the NAT IP address for the instance. // GetNatIP gets the NAT IP address for the instance.
GetNatIP(zone, name string) (string, error) GetNatIP(zone, name string) (string, error)
// GetSerialPortOutput gets the Serial Port contents for the instance. // GetSerialPortOutput gets the Serial Port contents for the instance.
GetSerialPortOutput(zone, name string) (string, error) GetSerialPortOutput(zone, name string) (string, error)

View File

@ -54,7 +54,7 @@ type DriverMock struct {
GetInternalIPName string GetInternalIPName string
GetInternalIPResult string GetInternalIPResult string
GetInternalIPErr error GetInternalIPErr error
GetSerialPortOutputZone string GetSerialPortOutputZone string
GetSerialPortOutputName string GetSerialPortOutputName string
GetSerialPortOutputResult string GetSerialPortOutputResult string

View File

@ -1,19 +1,19 @@
package googlecompute package googlecompute
import( import (
"testing"
"fmt" "fmt"
"testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func StubImage(name, project string, licenses []string, sizeGb int64) *Image { func StubImage(name, project string, licenses []string, sizeGb int64) *Image {
return &Image{ return &Image{
Licenses: licenses, Licenses: licenses,
Name: name, Name: name,
ProjectId: project, ProjectId: project,
SelfLink: fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/images/%s", project, name), SelfLink: fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/images/%s", project, name),
SizeGb: sizeGb, SizeGb: sizeGb,
} }
} }

View File

@ -28,12 +28,12 @@ func TestStepCreateImage(t *testing.T) {
// run the step // run the step
action := step.Run(state) action := step.Run(state)
assert.Equal(t, action, multistep.ActionContinue, "Step did not pass.") assert.Equal(t, action, multistep.ActionContinue, "Step did not pass.")
uncastImage, ok := state.GetOk("image") uncastImage, ok := state.GetOk("image")
assert.True(t, ok, "State does not have resulting image.") assert.True(t, ok, "State does not have resulting image.")
image, ok := uncastImage.(*Image) image, ok := uncastImage.(*Image)
assert.True(t, ok, "Image in state is not an Image.") assert.True(t, ok, "Image in state is not an Image.")
// Verify created Image results. // Verify created Image results.
assert.Equal(t, image.Licenses, d.CreateImageResultLicenses, "Created image licenses don't match the licenses returned by the driver.") assert.Equal(t, image.Licenses, d.CreateImageResultLicenses, "Created image licenses don't match the licenses returned by the driver.")
assert.Equal(t, image.Name, c.ImageName, "Created image does not match config name.") assert.Equal(t, image.Name, c.ImageName, "Created image does not match config name.")

View File

@ -31,7 +31,7 @@ func (c *Config) createInstanceMetadata(sourceImage *Image, sshPublicKey string)
sshKeys = fmt.Sprintf("%s\n%s", sshKeys, confSshKeys) sshKeys = fmt.Sprintf("%s\n%s", sshKeys, confSshKeys)
} }
instanceMetadata[sshMetaKey] = sshKeys instanceMetadata[sshMetaKey] = sshKeys
// Wrap any startup script with our own startup script. // Wrap any startup script with our own startup script.
if c.StartupScriptFile != "" { if c.StartupScriptFile != "" {
var content []byte var content []byte

View File

@ -71,8 +71,8 @@ func (s *StepTeardownInstance) Cleanup(state multistep.StateBag) {
if err != nil { if err != nil {
ui.Error(fmt.Sprintf( ui.Error(fmt.Sprintf(
"Error deleting disk. Please delete it manually.\n\n"+ "Error deleting disk. Please delete it manually.\n\n"+
"DiskName: %s\n" + "DiskName: %s\n"+
"Zone: %s\n" + "Zone: %s\n"+
"Error: %s", config.DiskName, config.Zone, err)) "Error: %s", config.DiskName, config.Zone, err))
} }

View File

@ -2,8 +2,8 @@ package googlecompute
import ( import (
"github.com/mitchellh/multistep" "github.com/mitchellh/multistep"
"testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"testing"
) )
func TestStepWaitInstanceStartup(t *testing.T) { func TestStepWaitInstanceStartup(t *testing.T) {
@ -11,7 +11,7 @@ func TestStepWaitInstanceStartup(t *testing.T) {
step := new(StepWaitInstanceStartup) step := new(StepWaitInstanceStartup)
c := state.Get("config").(*Config) c := state.Get("config").(*Config)
d := state.Get("driver").(*DriverMock) d := state.Get("driver").(*DriverMock)
testZone := "test-zone" testZone := "test-zone"
testInstanceName := "test-instance-name" testInstanceName := "test-instance-name"
@ -20,11 +20,11 @@ func TestStepWaitInstanceStartup(t *testing.T) {
// This step stops when it gets Done back from the metadata. // This step stops when it gets Done back from the metadata.
d.GetInstanceMetadataResult = StartupScriptStatusDone d.GetInstanceMetadataResult = StartupScriptStatusDone
// Run the step. // Run the step.
assert.Equal(t, step.Run(state), multistep.ActionContinue, "Step should have passed and continued.") assert.Equal(t, step.Run(state), multistep.ActionContinue, "Step should have passed and continued.")
// Check that GetInstanceMetadata was called properly. // Check that GetInstanceMetadata was called properly.
assert.Equal(t, d.GetInstanceMetadataZone, testZone, "Incorrect zone passed to GetInstanceMetadata.") assert.Equal(t, d.GetInstanceMetadataZone, testZone, "Incorrect zone passed to GetInstanceMetadata.")
assert.Equal(t, d.GetInstanceMetadataName, testInstanceName, "Incorrect instance name passed to GetInstanceMetadata.") assert.Equal(t, d.GetInstanceMetadataName, testInstanceName, "Incorrect instance name passed to GetInstanceMetadata.")
} }

View File

@ -46,13 +46,13 @@ func EncodeVMX(contents map[string]string) string {
// a list of VMX key fragments that the value must not be quoted // a list of VMX key fragments that the value must not be quoted
// fragments are used to cover multliples (i.e. multiple disks) // fragments are used to cover multliples (i.e. multiple disks)
// keys are still lowercase at this point, use lower fragments // keys are still lowercase at this point, use lower fragments
noQuotes := []string { noQuotes := []string{
".virtualssd", ".virtualssd",
} }
// a list of VMX key fragments that are case sensitive // a list of VMX key fragments that are case sensitive
// fragments are used to cover multliples (i.e. multiple disks) // fragments are used to cover multliples (i.e. multiple disks)
caseSensitive := []string { caseSensitive := []string{
".virtualSSD", ".virtualSSD",
} }
@ -63,7 +63,7 @@ func EncodeVMX(contents map[string]string) string {
for _, q := range noQuotes { for _, q := range noQuotes {
if strings.Contains(k, q) { if strings.Contains(k, q) {
pat = "%s = %s\n" pat = "%s = %s\n"
break; break
} }
} }
key := k key := k

View File

@ -29,8 +29,8 @@ scsi0:0.virtualSSD = 1
func TestEncodeVMX(t *testing.T) { func TestEncodeVMX(t *testing.T) {
contents := map[string]string{ contents := map[string]string{
".encoding": "UTF-8", ".encoding": "UTF-8",
"config.version": "8", "config.version": "8",
"scsi0:0.virtualssd": "1", "scsi0:0.virtualssd": "1",
} }

View File

@ -15,50 +15,49 @@ import (
amazonchrootbuilder "github.com/mitchellh/packer/builder/amazon/chroot" amazonchrootbuilder "github.com/mitchellh/packer/builder/amazon/chroot"
amazonebsbuilder "github.com/mitchellh/packer/builder/amazon/ebs" amazonebsbuilder "github.com/mitchellh/packer/builder/amazon/ebs"
amazonimportpostprocessor "github.com/mitchellh/packer/post-processor/amazon-import"
amazoninstancebuilder "github.com/mitchellh/packer/builder/amazon/instance" amazoninstancebuilder "github.com/mitchellh/packer/builder/amazon/instance"
ansiblelocalprovisioner "github.com/mitchellh/packer/provisioner/ansible-local"
ansibleprovisioner "github.com/mitchellh/packer/provisioner/ansible"
artificepostprocessor "github.com/mitchellh/packer/post-processor/artifice"
atlaspostprocessor "github.com/mitchellh/packer/post-processor/atlas"
azurearmbuilder "github.com/mitchellh/packer/builder/azure/arm" azurearmbuilder "github.com/mitchellh/packer/builder/azure/arm"
checksumpostprocessor "github.com/mitchellh/packer/post-processor/checksum"
chefclientprovisioner "github.com/mitchellh/packer/provisioner/chef-client"
chefsoloprovisioner "github.com/mitchellh/packer/provisioner/chef-solo"
compresspostprocessor "github.com/mitchellh/packer/post-processor/compress"
digitaloceanbuilder "github.com/mitchellh/packer/builder/digitalocean" digitaloceanbuilder "github.com/mitchellh/packer/builder/digitalocean"
dockerbuilder "github.com/mitchellh/packer/builder/docker" dockerbuilder "github.com/mitchellh/packer/builder/docker"
dockerimportpostprocessor "github.com/mitchellh/packer/post-processor/docker-import"
dockerpushpostprocessor "github.com/mitchellh/packer/post-processor/docker-push"
dockersavepostprocessor "github.com/mitchellh/packer/post-processor/docker-save"
dockertagpostprocessor "github.com/mitchellh/packer/post-processor/docker-tag"
filebuilder "github.com/mitchellh/packer/builder/file" filebuilder "github.com/mitchellh/packer/builder/file"
fileprovisioner "github.com/mitchellh/packer/provisioner/file"
googlecomputebuilder "github.com/mitchellh/packer/builder/googlecompute" googlecomputebuilder "github.com/mitchellh/packer/builder/googlecompute"
googlecomputeexportpostprocessor "github.com/mitchellh/packer/post-processor/googlecompute-export"
manifestpostprocessor "github.com/mitchellh/packer/post-processor/manifest"
nullbuilder "github.com/mitchellh/packer/builder/null" nullbuilder "github.com/mitchellh/packer/builder/null"
openstackbuilder "github.com/mitchellh/packer/builder/openstack" openstackbuilder "github.com/mitchellh/packer/builder/openstack"
parallelsisobuilder "github.com/mitchellh/packer/builder/parallels/iso" parallelsisobuilder "github.com/mitchellh/packer/builder/parallels/iso"
parallelspvmbuilder "github.com/mitchellh/packer/builder/parallels/pvm" parallelspvmbuilder "github.com/mitchellh/packer/builder/parallels/pvm"
powershellprovisioner "github.com/mitchellh/packer/provisioner/powershell"
puppetmasterlessprovisioner "github.com/mitchellh/packer/provisioner/puppet-masterless"
puppetserverprovisioner "github.com/mitchellh/packer/provisioner/puppet-server"
qemubuilder "github.com/mitchellh/packer/builder/qemu" qemubuilder "github.com/mitchellh/packer/builder/qemu"
saltmasterlessprovisioner "github.com/mitchellh/packer/provisioner/salt-masterless"
shelllocalpostprocessor "github.com/mitchellh/packer/post-processor/shell-local"
shelllocalprovisioner "github.com/mitchellh/packer/provisioner/shell-local"
shellprovisioner "github.com/mitchellh/packer/provisioner/shell"
vagrantcloudpostprocessor "github.com/mitchellh/packer/post-processor/vagrant-cloud"
vagrantpostprocessor "github.com/mitchellh/packer/post-processor/vagrant"
virtualboxisobuilder "github.com/mitchellh/packer/builder/virtualbox/iso" virtualboxisobuilder "github.com/mitchellh/packer/builder/virtualbox/iso"
virtualboxovfbuilder "github.com/mitchellh/packer/builder/virtualbox/ovf" virtualboxovfbuilder "github.com/mitchellh/packer/builder/virtualbox/ovf"
vmwareisobuilder "github.com/mitchellh/packer/builder/vmware/iso" vmwareisobuilder "github.com/mitchellh/packer/builder/vmware/iso"
vmwarevmxbuilder "github.com/mitchellh/packer/builder/vmware/vmx" vmwarevmxbuilder "github.com/mitchellh/packer/builder/vmware/vmx"
amazonimportpostprocessor "github.com/mitchellh/packer/post-processor/amazon-import"
artificepostprocessor "github.com/mitchellh/packer/post-processor/artifice"
atlaspostprocessor "github.com/mitchellh/packer/post-processor/atlas"
checksumpostprocessor "github.com/mitchellh/packer/post-processor/checksum"
compresspostprocessor "github.com/mitchellh/packer/post-processor/compress"
dockerimportpostprocessor "github.com/mitchellh/packer/post-processor/docker-import"
dockerpushpostprocessor "github.com/mitchellh/packer/post-processor/docker-push"
dockersavepostprocessor "github.com/mitchellh/packer/post-processor/docker-save"
dockertagpostprocessor "github.com/mitchellh/packer/post-processor/docker-tag"
googlecomputeexportpostprocessor "github.com/mitchellh/packer/post-processor/googlecompute-export"
manifestpostprocessor "github.com/mitchellh/packer/post-processor/manifest"
shelllocalpostprocessor "github.com/mitchellh/packer/post-processor/shell-local"
vagrantpostprocessor "github.com/mitchellh/packer/post-processor/vagrant"
vagrantcloudpostprocessor "github.com/mitchellh/packer/post-processor/vagrant-cloud"
vspherepostprocessor "github.com/mitchellh/packer/post-processor/vsphere" vspherepostprocessor "github.com/mitchellh/packer/post-processor/vsphere"
ansibleprovisioner "github.com/mitchellh/packer/provisioner/ansible"
ansiblelocalprovisioner "github.com/mitchellh/packer/provisioner/ansible-local"
chefclientprovisioner "github.com/mitchellh/packer/provisioner/chef-client"
chefsoloprovisioner "github.com/mitchellh/packer/provisioner/chef-solo"
fileprovisioner "github.com/mitchellh/packer/provisioner/file"
powershellprovisioner "github.com/mitchellh/packer/provisioner/powershell"
puppetmasterlessprovisioner "github.com/mitchellh/packer/provisioner/puppet-masterless"
puppetserverprovisioner "github.com/mitchellh/packer/provisioner/puppet-server"
saltmasterlessprovisioner "github.com/mitchellh/packer/provisioner/salt-masterless"
shellprovisioner "github.com/mitchellh/packer/provisioner/shell"
shelllocalprovisioner "github.com/mitchellh/packer/provisioner/shell-local"
windowsrestartprovisioner "github.com/mitchellh/packer/provisioner/windows-restart" windowsrestartprovisioner "github.com/mitchellh/packer/provisioner/windows-restart"
windowsshellprovisioner "github.com/mitchellh/packer/provisioner/windows-shell" windowsshellprovisioner "github.com/mitchellh/packer/provisioner/windows-shell"
) )
type PluginCommand struct { type PluginCommand struct {
@ -67,61 +66,58 @@ type PluginCommand struct {
var Builders = map[string]packer.Builder{ var Builders = map[string]packer.Builder{
"amazon-chroot": new(amazonchrootbuilder.Builder), "amazon-chroot": new(amazonchrootbuilder.Builder),
"amazon-ebs": new(amazonebsbuilder.Builder), "amazon-ebs": new(amazonebsbuilder.Builder),
"amazon-instance": new(amazoninstancebuilder.Builder), "amazon-instance": new(amazoninstancebuilder.Builder),
"azure-arm": new(azurearmbuilder.Builder), "azure-arm": new(azurearmbuilder.Builder),
"digitalocean": new(digitaloceanbuilder.Builder), "digitalocean": new(digitaloceanbuilder.Builder),
"docker": new(dockerbuilder.Builder), "docker": new(dockerbuilder.Builder),
"file": new(filebuilder.Builder), "file": new(filebuilder.Builder),
"googlecompute": new(googlecomputebuilder.Builder), "googlecompute": new(googlecomputebuilder.Builder),
"null": new(nullbuilder.Builder), "null": new(nullbuilder.Builder),
"openstack": new(openstackbuilder.Builder), "openstack": new(openstackbuilder.Builder),
"parallels-iso": new(parallelsisobuilder.Builder), "parallels-iso": new(parallelsisobuilder.Builder),
"parallels-pvm": new(parallelspvmbuilder.Builder), "parallels-pvm": new(parallelspvmbuilder.Builder),
"qemu": new(qemubuilder.Builder), "qemu": new(qemubuilder.Builder),
"virtualbox-iso": new(virtualboxisobuilder.Builder), "virtualbox-iso": new(virtualboxisobuilder.Builder),
"virtualbox-ovf": new(virtualboxovfbuilder.Builder), "virtualbox-ovf": new(virtualboxovfbuilder.Builder),
"vmware-iso": new(vmwareisobuilder.Builder), "vmware-iso": new(vmwareisobuilder.Builder),
"vmware-vmx": new(vmwarevmxbuilder.Builder), "vmware-vmx": new(vmwarevmxbuilder.Builder),
} }
var Provisioners = map[string]packer.Provisioner{ var Provisioners = map[string]packer.Provisioner{
"ansible": new(ansibleprovisioner.Provisioner), "ansible": new(ansibleprovisioner.Provisioner),
"ansible-local": new(ansiblelocalprovisioner.Provisioner), "ansible-local": new(ansiblelocalprovisioner.Provisioner),
"chef-client": new(chefclientprovisioner.Provisioner), "chef-client": new(chefclientprovisioner.Provisioner),
"chef-solo": new(chefsoloprovisioner.Provisioner), "chef-solo": new(chefsoloprovisioner.Provisioner),
"file": new(fileprovisioner.Provisioner), "file": new(fileprovisioner.Provisioner),
"powershell": new(powershellprovisioner.Provisioner), "powershell": new(powershellprovisioner.Provisioner),
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner), "puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
"puppet-server": new(puppetserverprovisioner.Provisioner), "puppet-server": new(puppetserverprovisioner.Provisioner),
"salt-masterless": new(saltmasterlessprovisioner.Provisioner), "salt-masterless": new(saltmasterlessprovisioner.Provisioner),
"shell": new(shellprovisioner.Provisioner), "shell": new(shellprovisioner.Provisioner),
"shell-local": new(shelllocalprovisioner.Provisioner), "shell-local": new(shelllocalprovisioner.Provisioner),
"windows-restart": new(windowsrestartprovisioner.Provisioner), "windows-restart": new(windowsrestartprovisioner.Provisioner),
"windows-shell": new(windowsshellprovisioner.Provisioner), "windows-shell": new(windowsshellprovisioner.Provisioner),
} }
var PostProcessors = map[string]packer.PostProcessor{ var PostProcessors = map[string]packer.PostProcessor{
"amazon-import": new(amazonimportpostprocessor.PostProcessor), "amazon-import": new(amazonimportpostprocessor.PostProcessor),
"artifice": new(artificepostprocessor.PostProcessor), "artifice": new(artificepostprocessor.PostProcessor),
"atlas": new(atlaspostprocessor.PostProcessor), "atlas": new(atlaspostprocessor.PostProcessor),
"checksum": new(checksumpostprocessor.PostProcessor), "checksum": new(checksumpostprocessor.PostProcessor),
"compress": new(compresspostprocessor.PostProcessor), "compress": new(compresspostprocessor.PostProcessor),
"docker-import": new(dockerimportpostprocessor.PostProcessor), "docker-import": new(dockerimportpostprocessor.PostProcessor),
"docker-push": new(dockerpushpostprocessor.PostProcessor), "docker-push": new(dockerpushpostprocessor.PostProcessor),
"docker-save": new(dockersavepostprocessor.PostProcessor), "docker-save": new(dockersavepostprocessor.PostProcessor),
"docker-tag": new(dockertagpostprocessor.PostProcessor), "docker-tag": new(dockertagpostprocessor.PostProcessor),
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor), "googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
"manifest": new(manifestpostprocessor.PostProcessor), "manifest": new(manifestpostprocessor.PostProcessor),
"shell-local": new(shelllocalpostprocessor.PostProcessor), "shell-local": new(shelllocalpostprocessor.PostProcessor),
"vagrant": new(vagrantpostprocessor.PostProcessor), "vagrant": new(vagrantpostprocessor.PostProcessor),
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor), "vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
"vsphere": new(vspherepostprocessor.PostProcessor), "vsphere": new(vspherepostprocessor.PostProcessor),
} }
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)") var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
func (c *PluginCommand) Run(args []string) int { func (c *PluginCommand) Run(args []string) int {

View File

@ -13,4 +13,3 @@ func TestCommIsCommunicator(t *testing.T) {
t.Fatalf("comm must be a communicator") t.Fatalf("comm must be a communicator")
} }
} }

View File

@ -81,7 +81,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
RawStateTimeout: "5m", RawStateTimeout: "5m",
} }
exporterConfig.CalcTimeout() exporterConfig.CalcTimeout()
// Set up credentials and GCE driver. // Set up credentials and GCE driver.
b, err := ioutil.ReadFile(accountKeyFilePath) b, err := ioutil.ReadFile(accountKeyFilePath)
if err != nil { if err != nil {

View File

@ -18,9 +18,9 @@ import (
type Config struct { type Config struct {
common.PackerConfig `mapstructure:",squash"` common.PackerConfig `mapstructure:",squash"`
Filename string `mapstructure:"filename"` Filename string `mapstructure:"filename"`
StripPath bool `mapstructure:"strip_path"` StripPath bool `mapstructure:"strip_path"`
ctx interpolate.Context ctx interpolate.Context
} }
type PostProcessor struct { type PostProcessor struct {

View File

@ -98,9 +98,9 @@ type InstallChefTemplate struct {
} }
type KnifeTemplate struct { type KnifeTemplate struct {
Sudo bool Sudo bool
Flags string Flags string
Args string Args string
} }
func (p *Provisioner) Prepare(raws ...interface{}) error { func (p *Provisioner) Prepare(raws ...interface{}) error {
@ -500,7 +500,7 @@ func (p *Provisioner) knifeExec(ui packer.Ui, comm packer.Communicator, node str
} }
p.config.ctx.Data = &KnifeTemplate{ p.config.ctx.Data = &KnifeTemplate{
Sudo: !p.config.PreventSudo, Sudo: !p.config.PreventSudo,
Flags: strings.Join(flags, " "), Flags: strings.Join(flags, " "),
Args: strings.Join(args, " "), Args: strings.Join(args, " "),
} }

View File

@ -16,7 +16,7 @@ import (
type Config struct { type Config struct {
common.PackerConfig `mapstructure:",squash"` common.PackerConfig `mapstructure:",squash"`
ctx interpolate.Context ctx interpolate.Context
// The command used to execute Puppet. // The command used to execute Puppet.
ExecuteCommand string `mapstructure:"execute_command"` ExecuteCommand string `mapstructure:"execute_command"`
@ -76,11 +76,11 @@ func (p *Provisioner) Prepare(raws ...interface{}) error {
if err != nil { if err != nil {
return err return err
} }
if p.config.ExecuteCommand == "" { if p.config.ExecuteCommand == "" {
p.config.ExecuteCommand = p.commandTemplate() p.config.ExecuteCommand = p.commandTemplate()
} }
if p.config.StagingDir == "" { if p.config.StagingDir == "" {
p.config.StagingDir = "/tmp/packer-puppet-server" p.config.StagingDir = "/tmp/packer-puppet-server"
} }

View File

@ -4,9 +4,9 @@ import (
"github.com/mitchellh/packer/packer" "github.com/mitchellh/packer/packer"
"io/ioutil" "io/ioutil"
"os" "os"
"testing"
"strings"
"regexp" "regexp"
"strings"
"testing"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -306,7 +306,7 @@ func TestProvisioner_RemotePathSetViaRemotePathAndRemoteFile(t *testing.T) {
t.Fatalf("should not have error: %s", err) t.Fatalf("should not have error: %s", err)
} }
if p.config.RemotePath != expectedRemoteFolder + "/" + expectedRemoteFile { if p.config.RemotePath != expectedRemoteFolder+"/"+expectedRemoteFile {
t.Fatalf("remote path does not contain remote_file") t.Fatalf("remote path does not contain remote_file")
} }
} }