Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve ssh error #56460

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
4 participants
@bcoca
Copy link
Member

commented May 15, 2019

Allow original ssh error to be seen and traceback to be available on high verbosity
fixes #35313

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

connection/ssh

@bcoca

This comment has been minimized.

Copy link
Member Author

commented May 15, 2019

@JulienPalard

This comment has been minimized.

Copy link
Contributor

commented May 16, 2019

Hi Brian! Thanks for looking at it!

I tested your PR locally and it does not fix my personal issue, so I propose also changing:

diff --git a/lib/ansible/plugins/connection/ssh.py b/lib/ansible/plugins/connection/ssh.py
index 23a365f9db..36f76d57b7 100644
--- a/lib/ansible/plugins/connection/ssh.py
+++ b/lib/ansible/plugins/connection/ssh.py
@@ -1034,7 +1034,7 @@ class Connection(ConnectionBase):
             raise AnsibleControlPersistBrokenPipeError('SSH Error: data could not be sent because of ControlPersist broken pipe.')
 
         if p.returncode == 255 and in_data and checkrc:
-            raise AnsibleConnectionFailure('SSH Error: data could not be sent to remote host "%s". Make sure this host can be reached over ssh' % self.host)
+            raise AnsibleConnectionFailure('Data could not be sent to remote host "%s". Make sure this host can be reached over ssh: %s' % (self.host, to_native(b_stderr)))
 
         return (p.returncode, b_stdout, b_stderr)
 

without my change on your branch I'm getting:

TASK [Gathering Facts] ****************************************************************************************************************************
fatal: [staging.example.com]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"red.act.ed.ip\". Make sure this host can be reached over ssh", "unreachable": true}

with my change:

TASK [Gathering Facts] ****************************************************************************************************************************
fatal: [staging.example.com]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"red.act.ed.ip\". Make sure this host can be reached over ssh: sign_and_send_pubkey: signing failed: agent refused operation\r\nroot@red.act.ed.ip: Permission denied (publickey,password).\r\n", "unreachable": true}

@samdoran samdoran removed the needs_triage label May 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.