summaryrefslogtreecommitdiff
path: root/wintest
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-02-16 13:51:55 +1100
committerAndrew Bartlett <abartlet@samba.org>2012-02-16 15:20:09 +1100
commit2ba57f42b8d31d994d565d0c6daf339dddb61069 (patch)
tree7921a557f0fbcafb635d578a0f6aa5202c04ce02 /wintest
parent032a2c4ce3ec275379b1de37dccb0040071254c4 (diff)
downloadsamba-2ba57f42b8d31d994d565d0c6daf339dddb61069.tar.gz
samba-2ba57f42b8d31d994d565d0c6daf339dddb61069.tar.bz2
samba-2ba57f42b8d31d994d565d0c6daf339dddb61069.zip
wintest: Retry joining the domain a few times
Diffstat (limited to 'wintest')
-rw-r--r--wintest/wintest.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py
index 325da964e2..8bdd7a85eb 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -824,10 +824,18 @@ RebootOnCompletion=No
def run_winjoin(self, vm, domain, username="administrator", password="${PASSWORD1}"):
'''join a windows box to a domain'''
child = self.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True, set_noexpire=True)
- child.sendline("ipconfig /flushdns")
- child.expect("C:")
- child.sendline("netdom join ${WIN_HOSTNAME} /Domain:%s /UserD:%s /PasswordD:%s" % (domain, username, password))
- child.expect("The command completed successfully")
+ retries = 5
+ while retries > 0:
+ child.sendline("ipconfig /flushdns")
+ child.expect("C:")
+ child.sendline("netdom join ${WIN_HOSTNAME} /Domain:%s /UserD:%s /PasswordD:%s" % (domain, username, password))
+ i = child.expect(["The command completed successfully",
+ "The specified domain either does not exist or could not be contacted."])
+ if i == 0:
+ break
+ time.sleep(10)
+ retries -= 1
+
child.expect("C:")
child.sendline("shutdown /r -t 0")
self.wait_reboot()