MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / resolveNodeSSHCreds

Method resolveNodeSSHCreds

internal/cli/cli_helpers.go:427–448  ·  view source on GitHub ↗

resolveNodeSSHCreds returns the SSH username and jump-host config for a node, preferring the node's source profile when available.

(node *api.Node)

Source from the content-addressed store, hash-verified

425// resolveNodeSSHCreds returns the SSH username and jump-host config for a node,
426// preferring the node's source profile when available.
427func (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.
451func (s *cliSession) resolveNodeSSHKeyfile(node *api.Node) string {

Callers 5

runNodesShellFunction · 0.80
buildCommunityScriptPlanFunction · 0.80
runLXCShellFunction · 0.80
runQEMUShellFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected