remove unhelpful quotes to fix bug with reading key from a path with spaces in it.

pull/8605/head
Megan Marsh 6 years ago
parent 06a26e74b4
commit 5980d32efb

@ -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

@ -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

Loading…
Cancel
Save