Skip to content

Commit

Permalink
fixes and vet passing
Browse files Browse the repository at this point in the history
  • Loading branch information
klizhentas committed Feb 12, 2017
1 parent 4967287 commit f9bddef
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ func NewClient(c *Config) (tc *TeleportClient, err error) {
return nil, trace.Errorf("No proxy address specified, missed --proxy flag?")
}
if c.HostLogin == "" {
c.Username, err = Username()
c.HostLogin, err = Username()
if err != nil {
return nil, trace.Wrap(err)
}
Expand Down
5 changes: 3 additions & 2 deletions tool/tsh/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ func run(args []string, underTest bool) {
// configure CLI argument parser:
app := utils.InitCLIParser("tsh", "TSH: Teleport SSH client").Interspersed(false)
app.Flag("login", "Remote host login").Short('l').Envar("TELEPORT_LOGIN").StringVar(&cf.NodeLogin)
app.Flag("user", fmt.Sprintf("SSH proxy user [%s]", client.Username())).Envar("TELEPORT_USER").StringVar(&cf.Username)
localUser, _ := client.Username()
app.Flag("user", fmt.Sprintf("SSH proxy user [%s]", localUser)).Envar("TELEPORT_USER").StringVar(&cf.Username)
app.Flag("auth", "[EXPERIMENTAL] Use external authentication, e.g. 'google'").Envar("TELEPORT_AUTH").Hidden().StringVar(&cf.ExternalAuth)
app.Flag("u2f", "Use U2F as second factor").Default("false").BoolVar(&cf.U2F)
app.Flag("cluster", "Specify the cluster to connect").Envar("TELEPORT_SITE").StringVar(&cf.SiteName)
Expand Down Expand Up @@ -378,7 +379,7 @@ export SSH_AGENT_PID=%v

// create a new teleport agent and start listening
agentServer := teleagent.AgentServer{
tc.LocalAgent(),
Agent: tc.LocalAgent(),
}
if err := agentServer.ListenAndServe(socketAddr); err != nil {
utils.FatalError(err)
Expand Down
4 changes: 3 additions & 1 deletion tool/tsh/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ func (s *MainTestSuite) TestMakeClient(c *check.C) {
c.Assert(tc.Config.NodeHostPort(), check.Equals, "localhost:0") // SSH port must not be set to default!
c.Assert(tc.Config.ProxySSHHostPort(), check.Equals, "proxy:3023")
c.Assert(tc.Config.ProxyWebHostPort(), check.Equals, "proxy:3080")
c.Assert(tc.Config.HostLogin, check.Equals, client.Username())
localUser, err := client.Username()
c.Assert(err, check.IsNil)
c.Assert(tc.Config.HostLogin, check.Equals, localUser)
c.Assert(tc.Config.KeyTTL, check.Equals, defaults.CertDuration)

// specific configuration
Expand Down

0 comments on commit f9bddef

Please sign in to comment.