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

Method clientForVM

internal/cli/cli_helpers.go:126–137  ·  view source on GitHub ↗

clientForVM returns the API client responsible for the given guest. In group mode it resolves via SourceProfile; in single mode it returns the single client.

(vm *api.VM)

Source from the content-addressed store, hash-verified

124// clientForVM returns the API client responsible for the given guest. In group
125// mode it resolves via SourceProfile; in single mode it returns the single client.
126func (s *cliSession) clientForVM(vm *api.VM) (*api.Client, error) {
127 if s.group != nil {
128 pc, exists := s.group.GetClient(vm.SourceProfile)
129 if !exists || pc == nil {
130 return nil, fmt.Errorf("no client for profile %q", vm.SourceProfile)
131 }
132
133 return pc.Client, nil
134 }
135
136 return s.single, nil
137}
138
139// getTasks returns recent cluster tasks across all profiles.
140func (s *cliSession) getTasks(ctx context.Context) ([]*api.ClusterTask, error) {

Callers 4

runGuestsDeleteFunction · 0.80
makeLifecycleCmdFunction · 0.80
runGuestsExecFunction · 0.80
runGuestsMigrateFunction · 0.80

Calls 1

GetClientMethod · 0.80

Tested by

no test coverage detected