findNodeIP returns the IP address of the named node.
(ctx context.Context, nodeName string)
| 336 | |
| 337 | // findNodeIP returns the IP address of the named node. |
| 338 | func (s *cliSession) findNodeIP(ctx context.Context, nodeName string) (string, error) { |
| 339 | nodes, err := s.getNodes(ctx) |
| 340 | if err != nil { |
| 341 | return "", fmt.Errorf("failed to fetch nodes: %w", err) |
| 342 | } |
| 343 | |
| 344 | for _, n := range nodes { |
| 345 | if n != nil && n.Name == nodeName { |
| 346 | return n.IP, nil |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | return "", fmt.Errorf("node %q not found", nodeName) |
| 351 | } |
| 352 | |
| 353 | // resolveSSHCreds returns the SSH username, keyfile path, and jump-host config |
| 354 | // to use for the node that hosts vm, preferring the guest's source profile when available. |
no test coverage detected