Allow to use GetSigner with vagrant provider

In order to run tests that require ssh access to a node on vagrant
we need to provide path to private ssh key.

Now it will be possible to do using VAGRANT_SSH_KEY environment variable

Change-Id: Ic5fe0037edd46d0db3b8036ad7fc03cf1ea07574
This commit is contained in:
Dmitry Shulyak 2016-09-13 11:23:55 +03:00
parent 8a56b6b27c
commit 615d1d6336

View File

@ -4098,6 +4098,12 @@ func GetSigner(provider string) (ssh.Signer, error) {
}
// Otherwise revert to home dir
keyfile = "kube_aws_rsa"
case "vagrant":
keyfile := os.Getenv("VAGRANT_SSH_KEY")
if len(keyfile) != 0 {
return sshutil.MakePrivateKeySignerFromFile(keyfile)
}
return nil, fmt.Errorf("VAGRANT_SSH_KEY env variable should be provided")
default:
return nil, fmt.Errorf("GetSigner(...) not implemented for %s", provider)
}