fmt
This commit is contained in:
parent
f5003c4e19
commit
8b25acfab6
|
@ -21,17 +21,17 @@ func (s *stepExport) Run(state map[string]interface{}) multistep.StepAction {
|
||||||
ui := state["ui"].(packer.Ui)
|
ui := state["ui"].(packer.Ui)
|
||||||
vmName := state["vmName"].(string)
|
vmName := state["vmName"].(string)
|
||||||
|
|
||||||
// Clear out the Packer-created forwarding rule
|
// Clear out the Packer-created forwarding rule
|
||||||
ui.Say(fmt.Sprintf("Deleting forwarded port mapping for SSH (host port %d)", state["sshHostPort"]))
|
ui.Say(fmt.Sprintf("Deleting forwarded port mapping for SSH (host port %d)", state["sshHostPort"]))
|
||||||
command := []string{"modifyvm", vmName, "--natpf1", "delete", "packerssh"}
|
command := []string{"modifyvm", vmName, "--natpf1", "delete", "packerssh"}
|
||||||
if err := driver.VBoxManage(command...); err != nil {
|
if err := driver.VBoxManage(command...); err != nil {
|
||||||
err := fmt.Errorf("Error deleting port forwarding rule: %s", err)
|
err := fmt.Errorf("Error deleting port forwarding rule: %s", err)
|
||||||
state["error"] = err
|
state["error"] = err
|
||||||
ui.Error(err.Error())
|
ui.Error(err.Error())
|
||||||
return multistep.ActionHalt
|
return multistep.ActionHalt
|
||||||
}
|
}
|
||||||
|
|
||||||
// Export the VM to an OVF
|
// Export the VM to an OVF
|
||||||
outputPath := filepath.Join(config.OutputDir, "packer.ovf")
|
outputPath := filepath.Join(config.OutputDir, "packer.ovf")
|
||||||
|
|
||||||
command = []string{
|
command = []string{
|
||||||
|
|
|
@ -79,12 +79,14 @@ func (p *AWSBoxPostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact
|
||||||
log.Printf("Using vagrantfile template: %s", p.config.VagrantfileTemplate)
|
log.Printf("Using vagrantfile template: %s", p.config.VagrantfileTemplate)
|
||||||
f, err := os.Open(p.config.VagrantfileTemplate)
|
f, err := os.Open(p.config.VagrantfileTemplate)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("error opening vagrantfile template: %s", err)
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
contents, err := ioutil.ReadAll(f)
|
contents, err := ioutil.ReadAll(f)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = fmt.Errorf("error reading vagrantfile template: %s", err)
|
||||||
return nil, false, err
|
return nil, false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ func DirToBox(dst, dir string) error {
|
||||||
|
|
||||||
// Skip directories
|
// Skip directories
|
||||||
if info.IsDir() {
|
if info.IsDir() {
|
||||||
log.Printf("Skiping directory '%s' for box '%s'", path, dst)
|
log.Printf("Skipping directory '%s' for box '%s'", path, dst)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ func TestProvisionerProvision_SendsFile(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
config := map[string]interface{}{
|
config := map[string]interface{}{
|
||||||
"source": tf.Name(),
|
"source": tf.Name(),
|
||||||
"destination": "something",
|
"destination": "something",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue