diff --git a/builder/vagrant/driver_2_2.go b/builder/vagrant/driver_2_2.go index 0e1110517..b7a22ad2d 100644 --- a/builder/vagrant/driver_2_2.go +++ b/builder/vagrant/driver_2_2.go @@ -201,7 +201,7 @@ func (d *Vagrant_2_2_Driver) vagrantCmd(args ...string) (string, string, error) err := cmd.Start() if err != nil { - return "", "", fmt.Errorf("Error starting vagrant command with args: %s", + return "", "", fmt.Errorf("Error starting vagrant command with args: %q", strings.Join(args, " ")) } diff --git a/builder/vagrant/step_ssh_config.go b/builder/vagrant/step_ssh_config.go index 588e20b43..3cf4c1817 100644 --- a/builder/vagrant/step_ssh_config.go +++ b/builder/vagrant/step_ssh_config.go @@ -4,7 +4,6 @@ import ( "context" "log" "strconv" - "strings" "github.com/hashicorp/packer/helper/multistep" ) @@ -57,12 +56,9 @@ func (s *StepSSHConfig) Run(ctx context.Context, state multistep.StateBag) multi } 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) + sshConfig.IdentityFile, err = strconv.Unquote(sshConfig.IdentityFile) + if err != nil { + log.Printf("Error unquoting identity file: %s", err) } config.Comm.SSHPrivateKeyFile = sshConfig.IdentityFile config.Comm.SSHUsername = sshConfig.User