Merge pull request #1171 from nathanleclaire/fixup_cert_copy

Fix cert copying bug [URGENT]
This commit is contained in:
Evan Hazlett 2015-05-14 02:26:56 -04:00
commit d56cc66274
2 changed files with 9 additions and 4 deletions

View File

@ -30,8 +30,9 @@ func RunSSHCommandFromDriver(d Driver, command string) (ssh.Output, error) {
return output, err
}
log.Debugf("About to run SSH command:\n%s", command)
output, err = client.Run(command)
log.Debug(fmt.Sprintf("SSH cmd err, output: %v: %s", err, output))
log.Debugf("SSH cmd err, output: %v: %s", err, output)
return output, err
}

View File

@ -130,16 +130,20 @@ func ConfigureAuth(p Provisioner) error {
return err
}
// printf will choke if we don't pass a format string because of the
// dashes, so that's the reason for the '%%s'
certTransferCmdFmt := "printf '%%s' '%s' | sudo tee %s"
// These ones are for Jessie and Mike <3 <3 <3
if _, err := p.SSHCommand(fmt.Sprintf("printf \"%s\" | sudo tee %s", string(caCert), authOptions.CaCertRemotePath)); err != nil {
if _, err := p.SSHCommand(fmt.Sprintf(certTransferCmdFmt, string(caCert), authOptions.CaCertRemotePath)); err != nil {
return err
}
if _, err := p.SSHCommand(fmt.Sprintf("printf \"%s\" | sudo tee %s", string(serverCert), authOptions.ServerCertRemotePath)); err != nil {
if _, err := p.SSHCommand(fmt.Sprintf(certTransferCmdFmt, string(serverCert), authOptions.ServerCertRemotePath)); err != nil {
return err
}
if _, err := p.SSHCommand(fmt.Sprintf("printf \"%s\" | sudo tee %s", string(serverKey), authOptions.ServerKeyRemotePath)); err != nil {
if _, err := p.SSHCommand(fmt.Sprintf(certTransferCmdFmt, string(serverKey), authOptions.ServerKeyRemotePath)); err != nil {
return err
}