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

Method findNodeByName

internal/cli/cli_helpers.go:410–423  ·  view source on GitHub ↗

findNodeByName returns the node with the given name, or an error if not found.

(ctx context.Context, name string)

Source from the content-addressed store, hash-verified

408
409// findNodeByName returns the node with the given name, or an error if not found.
410func (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.

Callers 6

runNodesShellFunction · 0.80
buildCommunityScriptPlanFunction · 0.80
runGuestsCreateVMFunction · 0.80
runGuestsCreateLXCFunction · 0.80
runGuestsMigrateFunction · 0.80

Calls 1

getNodesMethod · 0.95

Tested by

no test coverage detected