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

Method findNodeIP

internal/cli/cli_helpers.go:338–351  ·  view source on GitHub ↗

findNodeIP returns the IP address of the named node.

(ctx context.Context, nodeName string)

Source from the content-addressed store, hash-verified

336
337// findNodeIP returns the IP address of the named node.
338func (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.

Callers 2

execLXCMethod · 0.95
runLXCShellFunction · 0.80

Calls 1

getNodesMethod · 0.95

Tested by

no test coverage detected