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

CODENVY-2217: Change checking for SSH agent readiness #5260

Merged
merged 1 commit into from
Jun 2, 2017
Merged

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Jun 1, 2017

What does this PR do?

Changes checking algorithm for SSH agent.
Before, a readiness of SSH agent was checked by an attempt to open socket connection to SSH port of the machine. But this method doesn't work properly in some cases. For example, in case of docker-proxy socket connection will be opened, but actually the port isn't listening. This will cause workspace start failure.
That problem was fixed by changing of SSH agent readiness checking algorithm. Now checker tries to send a global SSH request and if SSH server is up, it should respond.

What issues does this PR fix or reference?

codenvy/codenvy#2217

Changelog

Improved SSH agent readiness checker.

Release Notes

Improved SSH agent readiness checker. This fixes workspace start failures from images without ssh server preinstalled.

Docs PR

N/A

BufferedOutputStream sshRequest = new BufferedOutputStream(socket.getOutputStream());
BufferedInputStream sshResponse = new BufferedInputStream(socket.getInputStream())) {
sshRequest.write(SSH_GLOBAL_REQUEST_BYTES);
sshRequest.flush();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format the code.

sshRequest.write(SSH_GLOBAL_REQUEST_BYTES);
sshRequest.flush();
// Actual response is not needed, just make sure that ssh server give a response.
if (sshResponse.read() != -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retrun sshResponse.read() != -1

Copy link
Contributor Author

@mmorhun mmorhun Jun 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that current code looks clearer.

Signed-off-by: Mykola Morhun <mmorhun@codenvy.com>
@bmicklea bmicklea added the kind/enhancement A feature request - must adhere to the feature request template. label Jun 1, 2017
@codenvy-ci
Copy link

@mmorhun mmorhun added this to the 5.12.0 milestone Jun 2, 2017
@mmorhun mmorhun merged commit 6d41a39 into master Jun 2, 2017
@mmorhun mmorhun deleted the CODENVY-2217 branch June 2, 2017 07:41
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants