Open wwahammy opened 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.
Eric, did you find a workable solution?
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.