Skip to content

Fixes #13491 - handle ssh disconnection#20

Merged
iNecas merged 2 commits intotheforeman:masterfrom
iNecas:handle-disconnect
Feb 12, 2016
Merged

Fixes #13491 - handle ssh disconnection#20
iNecas merged 2 commits intotheforeman:masterfrom
iNecas:handle-disconnect

Conversation

@iNecas
Copy link
Copy Markdown
Member

@iNecas iNecas commented Jan 31, 2016

For example, when rebooting as part for the script.

For example, when rebooting as part for the script.
@iNecas
Copy link
Copy Markdown
Member Author

iNecas commented Feb 1, 2016

I've added a simple detection of expected disconnections based on stdout. The plan is to seed power action template that will produce such output so that it just works (and the user doesn't have to know exactly what's the expected message to make the tasks green)

specific messages (such as 'restart host' on stdout) as last output of
a command cause the disconnect issue to not cause the task to fail, as
it's expected in that case.
@stbenjam
Copy link
Copy Markdown
Member

stbenjam commented Feb 1, 2016

The plan is to seed power action template that will produce such output so that it just works (and the user doesn't have to know exactly what's the expected message to make the tasks green)

Would it be possible to integrate into Foreman's power controls somehow? Not so familiar with this part but there is some BMC integration, and maybe there could be an alternative REX/SSH provider using the developer API.

@iNecas
Copy link
Copy Markdown
Member Author

iNecas commented Feb 2, 2016

For now, I've added a job template for the power management control: iNecas/foreman_remote_execution@9ec393c. Yes, the developer API could be used to intergrate it into the BMC, but I would prefer having a seperate issue opened for this.

def refresh_command_buffer
@logger.debug("command #{@command} got new output: #{@command_buffer.inspect}")
command_update = CommandUpdate.new(@command_buffer)
check_expecting_disconnect
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the point of check_expecting_disconnect here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We need to determine, if the disconnection was expected (such as when calling reboot) or it was an error. We need to do it on two places, because the @command_buffer could be filled in this, or previous iteration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh, I see, thanks for the explanation

@adamruzicka
Copy link
Copy Markdown
Contributor

Works as expected, ACK

@iNecas
Copy link
Copy Markdown
Member Author

iNecas commented Feb 12, 2016

Issue for the BMC provider filled here http://projects.theforeman.org/issues/13688

iNecas added a commit that referenced this pull request Feb 12, 2016
Fixes #13491 - handle ssh disconnection
@iNecas iNecas merged commit 89c6517 into theforeman:master Feb 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants