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

Ansible hides SSH errors #16732

Open
kustodian opened this Issue Jul 15, 2016 · 2 comments

Comments

Projects
None yet
6 participants
@kustodian
Contributor

kustodian commented Jul 15, 2016

ISSUE TYPE

Bug Report

COMPONENT NAME

core

ANSIBLE VERSION
ansible 2.1.1.0
CONFIGURATION

N/A

OS / ENVIRONMENT
SUMMARY

When an SSH error occurs Ansible only reports something like:

failed: [host-14] (item=1) => {"item": 1, "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh", "unreachable": true}

It hides the actual error which is reported by SSH which makes it very hard to troubleshoot problems with SSH.
Ansible should print the actual SSH error, like it did in the older version, at least in higher verbosity levels.

STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
@alikins

This comment has been minimized.

Show comment
Hide comment
@alikins

alikins Jul 15, 2016

Contributor

#16649 is more or less along the same line.

Though I'd say there are two bugs (or could be two prs). One to not hide stderr, the other to do something with it.

Contributor

alikins commented Jul 15, 2016

#16649 is more or less along the same line.

Though I'd say there are two bugs (or could be two prs). One to not hide stderr, the other to do something with it.

@paulRbr

This comment has been minimized.

Show comment
Hide comment
@paulRbr

paulRbr Sep 6, 2017

Contributor

I have noticed the same issue while spending 3 hours to debug a deployment that was not working on a test environment.

After the 3 hours analysis we have notices with my colleague that we had the problem when pipelining = True was activated on Ansible.

Digging further we clearly saw this line is a potential culprit:

except (OSError, IOError):
raise AnsibleConnectionFailure('SSH Error: data could not be sent to remote host "%s". Make sure this host can be reached over ssh' % self.host)

Indeed this error hides any OSError or IOError error that could occur during the ssh connection.
Issue #28870 is clearly the same problem (an OSError that gets hidden from Ansible).

I am not very confident in making changes in Ansible's codebase but @alikins do you think we could simply remove this raise and let the real exception pop?

Contributor

paulRbr commented Sep 6, 2017

I have noticed the same issue while spending 3 hours to debug a deployment that was not working on a test environment.

After the 3 hours analysis we have notices with my colleague that we had the problem when pipelining = True was activated on Ansible.

Digging further we clearly saw this line is a potential culprit:

except (OSError, IOError):
raise AnsibleConnectionFailure('SSH Error: data could not be sent to remote host "%s". Make sure this host can be reached over ssh' % self.host)

Indeed this error hides any OSError or IOError error that could occur during the ssh connection.
Issue #28870 is clearly the same problem (an OSError that gets hidden from Ansible).

I am not very confident in making changes in Ansible's codebase but @alikins do you think we could simply remove this raise and let the real exception pop?

@ansibot ansibot added bug and removed bug_report labels Mar 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment