--cluster flag was ignored for tsh join

Looks like `client.ConnectToNode()` always needs to be given the site name as
in "host:port@site" format. We do this for SSH, but forgot to do this
for Join.

Fixes #504
This commit is contained in:
Ev Kontsevoy 2016-08-17 17:30:10 -07:00
parent 2f60436d5f
commit 4ce8d5db0d

View file

@ -409,7 +409,11 @@ func (tc *TeleportClient) Join(sessionID session.ID, input io.Reader) (err error
return trace.NotFound(notFoundErrorMessage)
}
// connect to server:
nc, err := proxyClient.ConnectToNode(node.Addr, tc.Config.HostLogin)
fullNodeAddr := node.Addr
if tc.SiteName != "" {
fullNodeAddr = fmt.Sprintf("%s@%s", node.Addr, tc.SiteName)
}
nc, err := proxyClient.ConnectToNode(fullNodeAddr, tc.Config.HostLogin)
if err != nil {
return trace.Wrap(err)
}