qca / boardfarm

Main repo moved to:
https://github.com/mattsm/boardfarm/
BSD 3-Clause Clear License
71 stars 54 forks source link

Restart doesn't wait long enough if the host can't be found #63

Open wwahammy opened 8 years ago

wwahammy commented 8 years ago

At https://github.com/qca/boardfarm/blob/master/devices/debian.py#L80 the ping tests are supposed to be spread at least 1 second apart. This doesn't actually work if you're trying to ping a hostname which can't be found because it's rebooting. In that case, there's no delay of 1 second and the host isn't able to reboot fast enough and the reset fails.

I've done a work around for prpl by adding an extra time.sleep(1) in the except statement but that sort of changes the semantics. In some cases with the fix you'll wait 2 seconds (if the ping never returns) or 1 second if the host name can't be found. Nonetheless, it does wait long enough for a reboot.

mattsm commented 8 years ago

Two options:

1) Do DNS lookup first, and wait for it... but since it's weird you are probably getting IP via some local broadcast that makes me think 2 is better 2) pexpect.spawn("sleep 1 & ping ...; fg") or pexect.spawn("ping foo || sleep 1") - always wait one second, or wait a second if it fails...

Waiting 2 seconds is not the end of the world honestly.

mattsm commented 7 years ago

Eric, did you find a workable solution?