findNodeByName returns the node with the given name, or an error if not found.
(ctx context.Context, name string)
| 408 | |
| 409 | // findNodeByName returns the node with the given name, or an error if not found. |
| 410 | func (s *cliSession) findNodeByName(ctx context.Context, name string) (*api.Node, error) { |
| 411 | nodes, err := s.getNodes(ctx) |
| 412 | if err != nil { |
| 413 | return nil, fmt.Errorf("failed to fetch nodes: %w", err) |
| 414 | } |
| 415 | |
| 416 | for _, n := range nodes { |
| 417 | if n != nil && n.Name == name { |
| 418 | return n, nil |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | return nil, fmt.Errorf("node %q not found", name) |
| 423 | } |
| 424 | |
| 425 | // resolveNodeSSHCreds returns the SSH username and jump-host config for a node, |
| 426 | // preferring the node's source profile when available. |
no test coverage detected