resolveNodeSSHCreds returns the SSH username and jump-host config for a node, preferring the node's source profile when available.
(node *api.Node)
| 425 | // resolveNodeSSHCreds returns the SSH username and jump-host config for a node, |
| 426 | // preferring the node's source profile when available. |
| 427 | func (s *cliSession) resolveNodeSSHCreds(node *api.Node) (sshUser string, jumpHost config.SSHJumpHost) { |
| 428 | if node != nil && node.SourceProfile != "" { |
| 429 | if p, ok := s.cfg.Profiles[node.SourceProfile]; ok { |
| 430 | if p.SSHUser != "" { |
| 431 | sshUser = p.SSHUser |
| 432 | } |
| 433 | if p.SSHJumpHost.Addr != "" { |
| 434 | jumpHost = p.SSHJumpHost |
| 435 | } |
| 436 | } |
| 437 | } |
| 438 | |
| 439 | if sshUser == "" { |
| 440 | sshUser = s.cfg.SSHUser |
| 441 | } |
| 442 | |
| 443 | if jumpHost.Addr == "" { |
| 444 | jumpHost = s.cfg.SSHJumpHost |
| 445 | } |
| 446 | |
| 447 | return sshUser, jumpHost |
| 448 | } |
| 449 | |
| 450 | // resolveNodeSSHKeyfile returns the SSH keyfile to use when connecting to a node. |
| 451 | func (s *cliSession) resolveNodeSSHKeyfile(node *api.Node) string { |
no outgoing calls
no test coverage detected