@@ -523,6 +523,11 @@ def action_run_command(self):
523523 "context" : context ,
524524 }
525525
526+ def action_open_terminal (self ):
527+ """Open an interactive SSH terminal for the current server."""
528+ self .ensure_one ()
529+ return self .env ["cx.tower.terminal.session" ].action_open_for_server (self .id )
530+
526531 def action_run_flight_plan (self ):
527532 """
528533 Returns wizard action to select flightplan and run it
@@ -659,29 +664,28 @@ def _get_ssh_client(self, raise_on_error=False, timeout=5000, skip_host_key=Fals
659664 SSH: SSH manager instance or False and exception content
660665 """
661666 self .ensure_one ()
662- self = self .sudo ()
663667 try :
664- host_key = self ._get_secret_value ("host_key" )
668+ server = self .sudo ()
669+ host_key = server ._get_secret_value ("host_key" )
665670
666- # Check host only if IP address is present
667- skip_host_key = skip_host_key or self .skip_host_key
671+ skip_host_key = skip_host_key or server .skip_host_key
668672 if (
669673 not host_key
670674 and not skip_host_key
671- and (self .ip_v4_address or self .ip_v6_address )
675+ and (server .ip_v4_address or server .ip_v6_address )
672676 ):
673677 raise ValidationError (
674- _ ("Host key not found for server %(server)s" , server = self .name )
678+ _ ("Host key not found for server %(server)s" , server = server .name )
675679 )
676680
677681 connection = SSHConnection (
678- host = self .ip_v4_address or self .ip_v6_address ,
679- port = self .ssh_port ,
680- username = self .ssh_username ,
681- password = self ._get_ssh_password (),
682- ssh_key = self ._get_ssh_key (),
683- host_key = host_key if host_key and not self . skip_host_key else None ,
684- mode = self .ssh_auth_mode ,
682+ host = server .ip_v4_address or server .ip_v6_address ,
683+ port = server .ssh_port ,
684+ username = server .ssh_username ,
685+ password = server ._get_ssh_password (),
686+ ssh_key = server ._get_ssh_key (),
687+ host_key = host_key if host_key and not skip_host_key else None ,
688+ mode = server .ssh_auth_mode ,
685689 timeout = timeout ,
686690 )
687691 client = SSHManager (connection )
0 commit comments