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)
| 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. |
| 487 | func (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 |