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

Method resolveVMSSHKeyfile

internal/cli/cli_helpers.go:487–504  ·  view source on GitHub ↗

resolveVMSSHKeyfile returns the SSH keyfile to use when connecting directly to a QEMU VM. Prefers vm_ssh_keyfile, falls back to ssh_keyfile.

(vm *api.VM)

Source from the content-addressed store, hash-verified

485// resolveVMSSHKeyfile returns the SSH keyfile to use when connecting directly
486// to a QEMU VM. Prefers vm_ssh_keyfile, falls back to ssh_keyfile.
487func (s *cliSession) resolveVMSSHKeyfile(vm *api.VM) string {
488 if vm != nil && vm.SourceProfile != "" {
489 if p, ok := s.cfg.Profiles[vm.SourceProfile]; ok {
490 if p.VMSSHKeyfile != "" {
491 return p.VMSSHKeyfile
492 }
493 if p.SSHKeyfile != "" {
494 return p.SSHKeyfile
495 }
496 }
497 }
498
499 if s.cfg.VMSSHKeyfile != "" {
500 return s.cfg.VMSSHKeyfile
501 }
502
503 return s.cfg.SSHKeyfile
504}
505
506// execInteractiveShell runs the ssh binary interactively with the given
507// argument list, inheriting stdin/stdout/stderr. Unlike the TUI's ssh helpers

Callers 1

runQEMUShellFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected