diff --git a/builder/vagrant/driver_2_2.go b/builder/vagrant/driver_2_2.go index f6f72e05a..0e1110517 100644 --- a/builder/vagrant/driver_2_2.go +++ b/builder/vagrant/driver_2_2.go @@ -199,7 +199,11 @@ func (d *Vagrant_2_2_Driver) vagrantCmd(args ...string) (string, string, error) cmd.Stdout = &stdout cmd.Stderr = &stderr - cmd.Start() + err := cmd.Start() + if err != nil { + return "", "", fmt.Errorf("Error starting vagrant command with args: %s", + strings.Join(args, " ")) + } stdoutString := "" stderrString := "" @@ -238,7 +242,7 @@ func (d *Vagrant_2_2_Driver) vagrantCmd(args ...string) (string, string, error) } }() - err := cmd.Wait() + err = cmd.Wait() donech <- true diff --git a/builder/vagrant/step_ssh_config.go b/builder/vagrant/step_ssh_config.go index d28f10fe4..588e20b43 100644 --- a/builder/vagrant/step_ssh_config.go +++ b/builder/vagrant/step_ssh_config.go @@ -2,7 +2,9 @@ package vagrant import ( "context" + "log" "strconv" + "strings" "github.com/hashicorp/packer/helper/multistep" ) @@ -53,6 +55,15 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi // auth provided there. return multistep.ActionContinue } + log.Printf("identity file is %s", sshConfig.IdentityFile) + log.Printf("Removing quotes from identity file") + if strings.HasPrefix(sshConfig.IdentityFile, "\"") { + sshConfig.IdentityFile = sshConfig.IdentityFile[1:] + if strings.HasSuffix(sshConfig.IdentityFile, "\"") { + sshConfig.IdentityFile = sshConfig.IdentityFile[:len(sshConfig.IdentityFile)-1] + } + log.Printf("identity file is now %s", sshConfig.IdentityFile) + } config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile config.Comm.SSHUsername = sshConfig.User