-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpssh: Retry with TERM env variable set during failures
Currently gpssh always clears out the TERM env variable before performing SSH connections. This will cause problems when users want only to use a specific terminal (like tmux) when performing SSH connections since the empty TERM will cause some terminals to fail. To fix this issue, a retry operation is added when trying to login to a host. The first login attempt is made in the current manner where it clears out the `TERM` env variable. If it fails, then the operation is retried by restoring the `TERM` env variable. `gpssh` will now also print the exception in case of errors so that we get to know the actual reason for SSH failures aiding us in debugging. **Output During Failure** Before: ``` [gpadmin@cdw ~]$ gpssh -h cdw [ERROR] unable to login to cdw Could not acquire connection. ``` After: ``` [gpadmin@cdw ~]$ gpssh -h cdw [ERROR] unable to login to cdw Could not acquire connection. End Of File (EOF). Exception style platform. <gpssh_modules.gppxssh_wrapper.PxsshWrapper object at 0x7ffa144b7860> version: 3.3 command: /usr/bin/ssh args: ['/usr/bin/ssh', '-o', 'StrictHostKeyChecking=no', '-o', 'BatchMode=yes', '-q', '-l', 'gpadmin', 'cdw'] searcher: <pexpect.searcher_re object at 0x7ffa144b7c50> buffer (last 100 chars): b'' before (last 100 chars): b' 9 07:34:06 2024 from 10.0.34.166\r\r\nopen terminal failed: missing or unsuitable terminal: unknown\r\n' after: <class 'pexpect.EOF'> match: None match_index: None exitstatus: None flag_eof: True pid: 52832 child_fd: 3 closed: False timeout: 30 delimiter: <class 'pexpect.EOF'> logfile: None logfile_read: None logfile_send: None maxread: 2000 ignorecase: False searchwindowsize: None delaybeforesend: 0.05 delayafterclose: 0.1 delayafterterminate: 0.1 ```
- Loading branch information
Showing
2 changed files
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters