mirror of
https://github.com/hashicorp/packer.git
synced 2026-09-27 18:24:01 -04:00
remove unhelpful quotes to fix bug with reading key from a path with spaces in it.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user