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

Method FindNodeByNameInGroup

pkg/api/grouped-cluster.go:441–454  ·  view source on GitHub ↗

FindNodeByNameInGroup searches for a node with the given name across all profiles. Returns the node and its source profile name, or an error if not found.

(ctx context.Context, nodeName string)

Source from the content-addressed store, hash-verified

439// FindNodeByNameInGroup searches for a node with the given name across all profiles.
440// Returns the node and its source profile name, or an error if not found.
441func (m *GroupClientManager) FindNodeByNameInGroup(ctx context.Context, nodeName string) (*Node, string, error) {
442 nodes, err := m.GetGroupNodes(ctx)
443 if err != nil {
444 return nil, "", err
445 }
446
447 for _, node := range nodes {
448 if node.Name == nodeName {
449 return node, node.SourceProfile, nil
450 }
451 }
452
453 return nil, "", fmt.Errorf("node with name %s not found in any profile", nodeName)
454}
455
456// GetGroupTasks retrieves tasks from all connected profiles in the group.
457// Each task's SourceProfile field is set to identify which profile it came from.

Callers 1

clientForNodeMethod · 0.80

Calls 1

GetGroupNodesMethod · 0.95

Tested by

no test coverage detected