wait for port function
ClosedPublic

Authored by lbrabec on Aug 19 2015, 4:01 PM.

Details

Summary

function that repeatedly check if given port is open, used for determine
if machine is ready for ssh connection

Test Plan

manual testing

Diff Detail

Repository
rLTRN libtaskotron
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
lbrabec retitled this revision from to wait for port function.Aug 19 2015, 4:01 PM
lbrabec updated this object.
lbrabec edited the test plan for this revision. (Show Details)
lbrabec added reviewers: jskladan, tflink, kparal.
jskladan accepted this revision.Aug 20 2015, 11:22 AM

Just a few nitpicks, the code LGTM

libtaskotron/vm.py
108

Please add docstring

110

This feels like it should be configurable, but we already have so many options in config, that it's probably not worth it. Thoughts @kparal?

This revision is now accepted and ready to land.Aug 20 2015, 11:22 AM
lbrabec updated this revision to Diff 1362.Aug 20 2015, 12:15 PM
  • docs, timeout as kwarg
tflink accepted this revision.Aug 21 2015, 8:38 PM

LGTM, works on a simple rpmlint run on my local machine

libtaskotron/vm.py
110

I'm OK with it being like it is for now. To a certain point, configurable is better but this might be a bit on the low-level side. If we find problems with the value or a reason to make it variable, we can make it configurable later.

As nirik mentioned last week on IRC, unfortunately this might not solve issues with cloud-init. According to him, cloud-init does not block sshd service until it is configured, it often configures it after it has been started. So if this is intended to solve purely socket issue, it's fine, but we will have to have additional re-connection attempts also at the ssh level, until proper user certificate is installed (or maybe we can join both into a single place and retry the connection directly at the ssh level?).

libtaskotron/vm.py
116

If would be nice to mention here (probably as DEBUG) what machine:port we're waiting for and for how long.

126

I'd mention all of ipaddr, port and timeout in the error.

lbrabec updated this revision to Diff 1377.Aug 25 2015, 8:12 AM
  • code polishing
kparal accepted this revision.Aug 25 2015, 10:14 AM
Closed by commit rLTRN19e8f5041287: wait for port function (authored by Lukas Brabec <lbrabec@redhat.com>). · Explain WhyAug 25 2015, 10:30 AM
This revision was automatically updated to reflect the committed changes.