spell fixes
This commit is contained in:
parent
dfe6f11ea7
commit
230079f73a
|
@ -82,7 +82,7 @@ func (s *StepMountDevice) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
ui.Say("Mounting the root device...")
|
ui.Say("Mounting the root device...")
|
||||||
stderr := new(bytes.Buffer)
|
stderr := new(bytes.Buffer)
|
||||||
|
|
||||||
// build mount options from mount_options config, usefull for nouuid options
|
// build mount options from mount_options config, useful for nouuid options
|
||||||
// or other specific device type settings for mount
|
// or other specific device type settings for mount
|
||||||
opts := ""
|
opts := ""
|
||||||
if len(s.MountOptions) > 0 {
|
if len(s.MountOptions) > 0 {
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (s *StepSecurityGroup) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
// We loop and retry this a few times because sometimes the security
|
// We loop and retry this a few times because sometimes the security
|
||||||
// group isn't available immediately because AWS resources are eventaully
|
// group isn't available immediately because AWS resources are eventually
|
||||||
// consistent.
|
// consistent.
|
||||||
ui.Say(fmt.Sprintf(
|
ui.Say(fmt.Sprintf(
|
||||||
"Authorizing access to port %d the temporary security group...",
|
"Authorizing access to port %d the temporary security group...",
|
||||||
|
|
|
@ -84,11 +84,11 @@ func checkTags() builderT.TestCheckFunc {
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error retreiving Snapshots for AMI Artifcat (%#v) in Tags Test: %s", artifact, err)
|
return fmt.Errorf("Error retrieving Snapshots for AMI Artifact (%#v) in Tags Test: %s", artifact, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(resp.Snapshots) == 0 {
|
if len(resp.Snapshots) == 0 {
|
||||||
return fmt.Errorf("No Snapshots found for AMI Artifcat (%#v) in Tags Test", artifact)
|
return fmt.Errorf("No Snapshots found for AMI Artifact (%#v) in Tags Test", artifact)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab the snapshots, check the tags
|
// Grab the snapshots, check the tags
|
||||||
|
|
|
@ -99,7 +99,7 @@ func TestUploadDownload(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestLargeDownload verifies that files are the apporpriate size after being
|
// TestLargeDownload verifies that files are the appropriate size after being
|
||||||
// downloaded. This is to identify and fix the race condition in #2793. You may
|
// downloaded. This is to identify and fix the race condition in #2793. You may
|
||||||
// need to use github.com/cbednarski/rerun to verify since this problem occurs
|
// need to use github.com/cbednarski/rerun to verify since this problem occurs
|
||||||
// only intermittently.
|
// only intermittently.
|
||||||
|
|
|
@ -2,10 +2,11 @@ package openstack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/mitchellh/packer/packer"
|
|
||||||
"golang.org/x/crypto/ssh"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/mitchellh/packer/packer"
|
||||||
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ber_encoded_key = `
|
var ber_encoded_key = `
|
||||||
|
@ -71,7 +72,7 @@ mKMH6Gf6COfSIbLuejdzSOUAmjkFpm+nwBkka1eHdAy4ALn9wNQz3w==
|
||||||
func TestBerToDer(t *testing.T) {
|
func TestBerToDer(t *testing.T) {
|
||||||
_, err := exec.LookPath("openssl")
|
_, err := exec.LookPath("openssl")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Skipf("OpenSSL not availible skippint test.")
|
t.Skipf("OpenSSL not available skipping test.")
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := new(bytes.Buffer)
|
msg := new(bytes.Buffer)
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (s *StepAttachParallelsTools) Run(state multistep.StateBag) multistep.StepA
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Paralells Tools path on the host machine
|
// Get the Parallels Tools path on the host machine
|
||||||
parallelsToolsPath := state.Get("parallels_tools_path").(string)
|
parallelsToolsPath := state.Get("parallels_tools_path").(string)
|
||||||
|
|
||||||
// Attach the guest additions to the computer
|
// Attach the guest additions to the computer
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (s *StepUploadParallelsTools) Run(state multistep.StateBag) multistep.StepA
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Paralells Tools path on the host machine
|
// Get the Parallels Tools path on the host machine
|
||||||
parallelsToolsPath := state.Get("parallels_tools_path").(string)
|
parallelsToolsPath := state.Get("parallels_tools_path").(string)
|
||||||
|
|
||||||
f, err := os.Open(parallelsToolsPath)
|
f, err := os.Open(parallelsToolsPath)
|
||||||
|
|
|
@ -90,7 +90,7 @@ func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
||||||
b = Builder{}
|
b = Builder{}
|
||||||
_, errs := b.Prepare(config)
|
_, errs := b.Prepare(config)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
// Create the driver that we'll use to communicate with Parallels
|
// Create the driver that we'll use to communicate with Parallels
|
||||||
driver, err := parallelscommon.NewDriver()
|
driver, err := parallelscommon.NewDriver()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed creating Paralles driver: %s", err)
|
return nil, fmt.Errorf("Failed creating Parallels driver: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the state.
|
// Set up the state.
|
||||||
|
|
|
@ -87,7 +87,7 @@ func TestNewConfig_InvalidFloppies(t *testing.T) {
|
||||||
c["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
c["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
||||||
_, _, errs := NewConfig(c)
|
_, _, errs := NewConfig(c)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -4,12 +4,13 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/multistep"
|
|
||||||
"github.com/mitchellh/packer/packer"
|
|
||||||
"github.com/profitbricks/profitbricks-sdk-go"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/mitchellh/multistep"
|
||||||
|
"github.com/mitchellh/packer/packer"
|
||||||
|
"github.com/profitbricks/profitbricks-sdk-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepCreateServer struct{}
|
type stepCreateServer struct{}
|
||||||
|
@ -83,7 +84,7 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
err := s.waitTillProvisioned(datacenter.Headers.Get("Location"), *c)
|
err := s.waitTillProvisioned(datacenter.Headers.Get("Location"), *c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error occured while creating a datacenter %s", err.Error()))
|
ui.Error(fmt.Sprintf("Error occurred while creating a datacenter %s", err.Error()))
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,13 +98,13 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
})
|
})
|
||||||
|
|
||||||
if lan.StatusCode > 299 {
|
if lan.StatusCode > 299 {
|
||||||
ui.Error(fmt.Sprintf("Error occured %s", parseErrorMessage(lan.Response)))
|
ui.Error(fmt.Sprintf("Error occurred %s", parseErrorMessage(lan.Response)))
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.waitTillProvisioned(lan.Headers.Get("Location"), *c)
|
err = s.waitTillProvisioned(lan.Headers.Get("Location"), *c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error occured while creating a LAN %s", err.Error()))
|
ui.Error(fmt.Sprintf("Error occurred while creating a LAN %s", err.Error()))
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,13 +118,13 @@ func (s *stepCreateServer) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
})
|
})
|
||||||
|
|
||||||
if lan.StatusCode > 299 {
|
if lan.StatusCode > 299 {
|
||||||
ui.Error(fmt.Sprintf("Error occured %s", parseErrorMessage(nic.Response)))
|
ui.Error(fmt.Sprintf("Error occurred %s", parseErrorMessage(nic.Response)))
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
err = s.waitTillProvisioned(nic.Headers.Get("Location"), *c)
|
err = s.waitTillProvisioned(nic.Headers.Get("Location"), *c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf("Error occured while creating a NIC %s", err.Error()))
|
ui.Error(fmt.Sprintf("Error occurred while creating a NIC %s", err.Error()))
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ func (d *stepCreateServer) setPB(username string, password string, url string) {
|
||||||
|
|
||||||
func (d *stepCreateServer) checkForErrors(instance profitbricks.Resp) error {
|
func (d *stepCreateServer) checkForErrors(instance profitbricks.Resp) error {
|
||||||
if instance.StatusCode > 299 {
|
if instance.StatusCode > 299 {
|
||||||
return errors.New(fmt.Sprintf("Error occured %s", string(instance.Body)))
|
return errors.New(fmt.Sprintf("Error occurred %s", string(instance.Body)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,11 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
"github.com/profitbricks/profitbricks-sdk-go"
|
"github.com/profitbricks/profitbricks-sdk-go"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepTakeSnapshot struct{}
|
type stepTakeSnapshot struct{}
|
||||||
|
@ -49,7 +50,7 @@ func (s *stepTakeSnapshot) Cleanup(state multistep.StateBag) {
|
||||||
|
|
||||||
func (d *stepTakeSnapshot) checkForErrors(instance profitbricks.Resp) error {
|
func (d *stepTakeSnapshot) checkForErrors(instance profitbricks.Resp) error {
|
||||||
if instance.StatusCode > 299 {
|
if instance.StatusCode > 299 {
|
||||||
return errors.New(fmt.Sprintf("Error occured %s", string(instance.Body)))
|
return errors.New(fmt.Sprintf("Error occurred %s", string(instance.Body)))
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,11 +301,11 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) {
|
||||||
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
||||||
var b Builder
|
var b Builder
|
||||||
config := testConfig()
|
config := testConfig()
|
||||||
config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
config["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"}
|
||||||
b = Builder{}
|
b = Builder{}
|
||||||
_, errs := b.Prepare(config)
|
_, errs := b.Prepare(config)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -126,11 +126,11 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) {
|
||||||
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
||||||
var b Builder
|
var b Builder
|
||||||
config := testConfig()
|
config := testConfig()
|
||||||
config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
config["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"}
|
||||||
b = Builder{}
|
b = Builder{}
|
||||||
_, errs := b.Prepare(config)
|
_, errs := b.Prepare(config)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -42,10 +42,10 @@ func TestNewConfig_FloppyFiles(t *testing.T) {
|
||||||
|
|
||||||
func TestNewConfig_InvalidFloppies(t *testing.T) {
|
func TestNewConfig_InvalidFloppies(t *testing.T) {
|
||||||
c := testConfig(t)
|
c := testConfig(t)
|
||||||
c["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
c["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"}
|
||||||
_, _, errs := NewConfig(c)
|
_, _, errs := NewConfig(c)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -127,11 +127,11 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) {
|
||||||
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
||||||
var b Builder
|
var b Builder
|
||||||
config := testConfig()
|
config := testConfig()
|
||||||
config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
config["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"}
|
||||||
b = Builder{}
|
b = Builder{}
|
||||||
_, errs := b.Prepare(config)
|
_, errs := b.Prepare(config)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -56,11 +56,11 @@ func TestBuilderPrepare_FloppyFiles(t *testing.T) {
|
||||||
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
func TestBuilderPrepare_InvalidFloppies(t *testing.T) {
|
||||||
var b Builder
|
var b Builder
|
||||||
config := testConfig(t)
|
config := testConfig(t)
|
||||||
config["floppy_files"] = []string{"nonexistant.bat", "nonexistant.ps1"}
|
config["floppy_files"] = []string{"nonexistent.bat", "nonexistent.ps1"}
|
||||||
b = Builder{}
|
b = Builder{}
|
||||||
_, errs := b.Prepare(config)
|
_, errs := b.Prepare(config)
|
||||||
if errs == nil {
|
if errs == nil {
|
||||||
t.Fatalf("Non existant floppies should trigger multierror")
|
t.Fatalf("Non existent floppies should trigger multierror")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs.(*packer.MultiError).Errors) != 2 {
|
if len(errs.(*packer.MultiError).Errors) != 2 {
|
||||||
|
|
|
@ -211,7 +211,7 @@ func (c BuildCommand) Run(args []string) int {
|
||||||
|
|
||||||
c.Ui.Error("\n==> Some builds didn't complete successfully and had errors:")
|
c.Ui.Error("\n==> Some builds didn't complete successfully and had errors:")
|
||||||
for name, err := range errors {
|
for name, err := range errors {
|
||||||
// Create a UI for the machine readable stuff to be targetted
|
// Create a UI for the machine readable stuff to be targeted
|
||||||
ui := &packer.TargettedUi{
|
ui := &packer.TargettedUi{
|
||||||
Target: name,
|
Target: name,
|
||||||
Ui: c.Ui,
|
Ui: c.Ui,
|
||||||
|
@ -226,7 +226,7 @@ func (c BuildCommand) Run(args []string) int {
|
||||||
if len(artifacts.m) > 0 {
|
if len(artifacts.m) > 0 {
|
||||||
c.Ui.Say("\n==> Builds finished. The artifacts of successful builds are:")
|
c.Ui.Say("\n==> Builds finished. The artifacts of successful builds are:")
|
||||||
for name, buildArtifacts := range artifacts.m {
|
for name, buildArtifacts := range artifacts.m {
|
||||||
// Create a UI for the machine readable stuff to be targetted
|
// Create a UI for the machine readable stuff to be targeted
|
||||||
ui := &packer.TargettedUi{
|
ui := &packer.TargettedUi{
|
||||||
Target: name,
|
Target: name,
|
||||||
Ui: c.Ui,
|
Ui: c.Ui,
|
||||||
|
|
|
@ -56,7 +56,7 @@ func TestRetry(t *testing.T) {
|
||||||
return false, nil
|
return false, nil
|
||||||
})
|
})
|
||||||
if numTries != expectedTries {
|
if numTries != expectedTries {
|
||||||
t.Fatalf("Unsuccessul retry function should have been called %d times. Only called %d times.", expectedTries, numTries)
|
t.Fatalf("Unsuccessful retry function should have been called %d times. Only called %d times.", expectedTries, numTries)
|
||||||
}
|
}
|
||||||
if err != RetryExhaustedError {
|
if err != RetryExhaustedError {
|
||||||
t.Fatalf("Unsuccessful retry function should have returned a retry exhausted error. Actual error: %s", err)
|
t.Fatalf("Unsuccessful retry function should have returned a retry exhausted error. Actual error: %s", err)
|
||||||
|
|
|
@ -56,7 +56,7 @@ type Build interface {
|
||||||
Run(Ui, Cache) ([]Artifact, error)
|
Run(Ui, Cache) ([]Artifact, error)
|
||||||
|
|
||||||
// Cancel will cancel a running build. This will block until the build
|
// Cancel will cancel a running build. This will block until the build
|
||||||
// is actually completely cancelled.
|
// is actually completely canceled.
|
||||||
Cancel()
|
Cancel()
|
||||||
|
|
||||||
// SetDebug will enable/disable debug mode. Debug mode is always
|
// SetDebug will enable/disable debug mode. Debug mode is always
|
||||||
|
@ -210,7 +210,7 @@ func (b *coreBuild) Run(originalUi Ui, cache Cache) ([]Artifact, error) {
|
||||||
hook := &DispatchHook{Mapping: hooks}
|
hook := &DispatchHook{Mapping: hooks}
|
||||||
artifacts := make([]Artifact, 0, 1)
|
artifacts := make([]Artifact, 0, 1)
|
||||||
|
|
||||||
// The builder just has a normal Ui, but targetted
|
// The builder just has a normal Ui, but targeted
|
||||||
builderUi := &TargettedUi{
|
builderUi := &TargettedUi{
|
||||||
Target: b.Name(),
|
Target: b.Name(),
|
||||||
Ui: originalUi,
|
Ui: originalUi,
|
||||||
|
|
|
@ -14,7 +14,7 @@ type Builder interface {
|
||||||
// Prepare is responsible for configuring the builder and validating
|
// Prepare is responsible for configuring the builder and validating
|
||||||
// that configuration. Any setup should be done in this method. Note that
|
// that configuration. Any setup should be done in this method. Note that
|
||||||
// NO side effects should take place in prepare, it is meant as a state
|
// NO side effects should take place in prepare, it is meant as a state
|
||||||
// setup only. Calling Prepare is not necessarilly followed by a Run.
|
// setup only. Calling Prepare is not necessarily followed by a Run.
|
||||||
//
|
//
|
||||||
// The parameters to Prepare are a set of interface{} values of the
|
// The parameters to Prepare are a set of interface{} values of the
|
||||||
// configuration. These are almost always `map[string]interface{}`
|
// configuration. These are almost always `map[string]interface{}`
|
||||||
|
@ -24,7 +24,7 @@ type Builder interface {
|
||||||
// configuration.
|
// configuration.
|
||||||
//
|
//
|
||||||
// Prepare should return a list of warnings along with any errors
|
// Prepare should return a list of warnings along with any errors
|
||||||
// that occured while preparing.
|
// that occurred while preparing.
|
||||||
Prepare(...interface{}) ([]string, error)
|
Prepare(...interface{}) ([]string, error)
|
||||||
|
|
||||||
// Run is where the actual build should take place. It takes a Build and a Ui.
|
// Run is where the actual build should take place. It takes a Build and a Ui.
|
||||||
|
|
|
@ -33,7 +33,7 @@ type Config struct {
|
||||||
Name string `mapstructure:"ami_name"`
|
Name string `mapstructure:"ami_name"`
|
||||||
Description string `mapstructure:"ami_description"`
|
Description string `mapstructure:"ami_description"`
|
||||||
Users []string `mapstructure:"ami_users"`
|
Users []string `mapstructure:"ami_users"`
|
||||||
Groups []string `mapstrcuture:"ami_groups"`
|
Groups []string `mapstructure:"ami_groups"`
|
||||||
|
|
||||||
ctx interpolate.Context
|
ctx interpolate.Context
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ type PostProcessor struct {
|
||||||
config Config
|
config Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry point for configuration parisng when we've defined
|
// Entry point for configuration parsing when we've defined
|
||||||
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
p.config.ctx.Funcs = awscommon.TemplateFuncs
|
p.config.ctx.Funcs = awscommon.TemplateFuncs
|
||||||
err := config.Decode(&p.config, &config.DecodeOpts{
|
err := config.Decode(&p.config, &config.DecodeOpts{
|
||||||
|
@ -74,7 +74,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
|
||||||
// Check we have AWS access variables defined somewhere
|
// Check we have AWS access variables defined somewhere
|
||||||
errs = packer.MultiErrorAppend(errs, p.config.AccessConfig.Prepare(&p.config.ctx)...)
|
errs = packer.MultiErrorAppend(errs, p.config.AccessConfig.Prepare(&p.config.ctx)...)
|
||||||
|
|
||||||
// define all our required paramaters
|
// define all our required parameters
|
||||||
templates := map[string]*string{
|
templates := map[string]*string{
|
||||||
"s3_bucket_name": &p.config.S3Bucket,
|
"s3_bucket_name": &p.config.S3Bucket,
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Started import of s3://%s/%s, task id %s", p.config.S3Bucket, p.config.S3Key, *import_start.ImportTaskId))
|
ui.Message(fmt.Sprintf("Started import of s3://%s/%s, task id %s", p.config.S3Bucket, p.config.S3Key, *import_start.ImportTaskId))
|
||||||
|
|
||||||
// Wait for import process to complete, this takess a while
|
// Wait for import process to complete, this takes a while
|
||||||
ui.Message(fmt.Sprintf("Waiting for task %s to complete (may take a while)", *import_start.ImportTaskId))
|
ui.Message(fmt.Sprintf("Waiting for task %s to complete (may take a while)", *import_start.ImportTaskId))
|
||||||
|
|
||||||
stateChange := awscommon.StateChangeConf{
|
stateChange := awscommon.StateChangeConf{
|
||||||
|
@ -307,7 +307,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply atttributes for AMI specified in config
|
// Apply attributes for AMI specified in config
|
||||||
// (duped from builder/amazon/common/step_modify_ami_attributes.go)
|
// (duped from builder/amazon/common/step_modify_ami_attributes.go)
|
||||||
options := make(map[string]*ec2.ModifyImageAttributeInput)
|
options := make(map[string]*ec2.ModifyImageAttributeInput)
|
||||||
if p.config.Description != "" {
|
if p.config.Description != "" {
|
||||||
|
|
|
@ -54,7 +54,7 @@ func (s *stepUpload) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Message("Box succesfully uploaded")
|
ui.Message("Box successfully uploaded")
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,11 @@ package vagrantcloud
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mitchellh/multistep"
|
|
||||||
"github.com/mitchellh/packer/packer"
|
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/mitchellh/multistep"
|
||||||
|
"github.com/mitchellh/packer/packer"
|
||||||
)
|
)
|
||||||
|
|
||||||
type stepVerifyUpload struct {
|
type stepVerifyUpload struct {
|
||||||
|
@ -88,8 +89,8 @@ func (s *stepVerifyUpload) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.Message(fmt.Sprintf("Upload succesfully verified with token %s", providerCheck.HostedToken))
|
ui.Message(fmt.Sprintf("Upload successfully verified with token %s", providerCheck.HostedToken))
|
||||||
log.Printf("Box succesfully verified %s == %s", upload.Token, providerCheck.HostedToken)
|
log.Printf("Box successfully verified %s == %s", upload.Token, providerCheck.HostedToken)
|
||||||
|
|
||||||
return multistep.ActionContinue
|
return multistep.ActionContinue
|
||||||
case <-time.After(600 * time.Second):
|
case <-time.After(600 * time.Second):
|
||||||
|
|
|
@ -54,7 +54,7 @@ func scpUploadSession(opts []byte, rest string, in io.Reader, out io.Writer, com
|
||||||
// directory on the remote side, but ansible only sends files, so there's no
|
// directory on the remote side, but ansible only sends files, so there's no
|
||||||
// need to set targetIsDir, because it can be safely assumed that rest is
|
// need to set targetIsDir, because it can be safely assumed that rest is
|
||||||
// intended to be a file, and whatever names are used in 'C' commands are
|
// intended to be a file, and whatever names are used in 'C' commands are
|
||||||
// irrelavant.
|
// irrelevant.
|
||||||
state := &scpUploadState{target: rest, srcRoot: d, comm: comm}
|
state := &scpUploadState{target: rest, srcRoot: d, comm: comm}
|
||||||
|
|
||||||
fmt.Fprintf(out, scpOK) // signal the client to start the transfer.
|
fmt.Fprintf(out, scpOK) // signal the client to start the transfer.
|
||||||
|
|
|
@ -116,7 +116,7 @@ var waitForRestart = func(p *Provisioner, comm packer.Communicator) error {
|
||||||
cmd = &packer.RemoteCmd{Command: trycommand}
|
cmd = &packer.RemoteCmd{Command: trycommand}
|
||||||
err = cmd.StartWithUi(comm, ui)
|
err = cmd.StartWithUi(comm, ui)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Couldnt execute, we asume machine is rebooting already
|
// Couldn't execute, we assume machine is rebooting already
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if cmd.ExitStatus == 1115 || cmd.ExitStatus == 1190 {
|
if cmd.ExitStatus == 1115 || cmd.ExitStatus == 1190 {
|
||||||
|
@ -175,8 +175,8 @@ var waitForCommunicator = func(p *Provisioner) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-p.cancel:
|
case <-p.cancel:
|
||||||
log.Println("Communicator wait cancelled, exiting loop")
|
log.Println("Communicator wait canceled, exiting loop")
|
||||||
return fmt.Errorf("Communicator wait cancelled")
|
return fmt.Errorf("Communicator wait canceled")
|
||||||
case <-time.After(retryableSleep):
|
case <-time.After(retryableSleep):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ func TestRetryable(t *testing.T) {
|
||||||
err := p.Prepare(config)
|
err := p.Prepare(config)
|
||||||
err = p.retryable(retryMe)
|
err = p.retryable(retryMe)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("should not have error retrying funuction")
|
t.Fatalf("should not have error retrying function")
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -327,7 +327,7 @@ func TestRetryable(t *testing.T) {
|
||||||
err = p.Prepare(config)
|
err = p.Prepare(config)
|
||||||
err = p.retryable(retryMe)
|
err = p.retryable(retryMe)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("should have error retrying funuction")
|
t.Fatalf("should have error retrying function")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ func TestProvision_Cancel(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
<-waitDone
|
<-waitDone
|
||||||
|
|
||||||
// Expect interupt error
|
// Expect interrupt error
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("should have error")
|
t.Fatal("should have error")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue