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

Method handleRunVMCommand

internal/ui/plugins/commandrunner/plugin.go:190–223  ·  view source on GitHub ↗

handleRunVMCommand shows the command menu for the selected QEMU VM.

(ctx context.Context, app *components.App, node *api.Node, guest *api.VM)

Source from the content-addressed store, hash-verified

188
189// handleRunVMCommand shows the command menu for the selected QEMU VM.
190func (p *Plugin) handleRunVMCommand(ctx context.Context, app *components.App, node *api.Node, guest *api.VM) error {
191 if app == nil {
192 return fmt.Errorf("application context unavailable")
193 }
194
195 if node == nil {
196 return fmt.Errorf("no node selected")
197 }
198
199 if guest == nil {
200 return fmt.Errorf("no guest selected")
201 }
202
203 if p.runner == nil || !p.runner.Enabled() {
204 return fmt.Errorf("command runner not initialized")
205 }
206
207 p.updateSSHClient(node)
208
209 vmCtx := commandrunner.VM{
210 ID: guest.ID,
211 Node: node.Name,
212 Type: guest.Type,
213 Status: guest.Status,
214 AgentEnabled: guest.AgentEnabled,
215 AgentRunning: guest.AgentRunning,
216 OSType: guest.OSType,
217 }
218
219 // Show VM command menu
220 p.runner.ShowVMCommandMenu(vmCtx, nil)
221
222 return nil
223}
224
225func (p *Plugin) updateSSHClient(node *api.Node) {
226 if p == nil || p.runner == nil {

Callers

nothing calls this directly

Implementers 4

Plugininternal/ui/plugins/ansible/plugin.go
Plugininternal/ui/plugins/communityscripts/p
Plugininternal/ui/plugins/guestlist/plugin.g
Plugininternal/ui/plugins/commandrunner/plug

Calls 3

updateSSHClientMethod · 0.95
EnabledMethod · 0.80
ShowVMCommandMenuMethod · 0.45

Tested by

no test coverage detected