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

Method ExecuteOnProfile

pkg/api/group-client-operations.go:83–106  ·  view source on GitHub ↗

ExecuteOnProfile executes an operation on a specific profile by name. Returns the operation data and error.

(
	ctx context.Context,
	profileName string,
	operation ProfileOperation,
)

Source from the content-addressed store, hash-verified

81// ExecuteOnProfile executes an operation on a specific profile by name.
82// Returns the operation data and error.
83func (m *GroupClientManager) ExecuteOnProfile(
84 ctx context.Context,
85 profileName string,
86 operation ProfileOperation,
87) (interface{}, error) {
88 pc, exists := m.GetClient(profileName)
89 if !exists {
90 return nil, fmt.Errorf("profile '%s' not found in group '%s'", profileName, m.groupName)
91 }
92
93 status, _ := pc.GetStatus()
94 if status != ProfileStatusConnected {
95 return nil, fmt.Errorf("profile '%s' is not connected (status: %s)", profileName, status.String())
96 }
97
98 // Check context cancellation
99 select {
100 case <-ctx.Done():
101 return nil, ctx.Err()
102 default:
103 }
104
105 return operation(profileName, pc.Client)
106}
107
108// RefreshProfileConnection attempts to reconnect a failed profile.
109// This is useful for recovering from transient network errors.

Callers 2

GetNodeFromGroupMethod · 0.95
GetVMFromGroupMethod · 0.95

Calls 3

GetClientMethod · 0.95
GetStatusMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected