Merge pull request #8605 from hashicorp/fix_8599

remove unhelpful quotes to fix bug with reading key from a path with …
This commit is contained in:
Megan Marsh 2020-01-15 10:56:23 -08:00 committed by GitHub
commit b8edaa9850
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -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: %q",
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

View File

@ -2,6 +2,7 @@ package vagrant
import (
"context"
"log"
"strconv"
"github.com/hashicorp/packer/helper/multistep"
@ -53,6 +54,12 @@ 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")
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