Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request qca#6 from ericschultz/prpl_reboot_vms
Browse files Browse the repository at this point in the history
Fix prpl reboot for VMs
  • Loading branch information
wwahammy authored Aug 3, 2016
2 parents b56f92d + bf6a616 commit c64c7e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions devices/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self,

def reset(self):
self.sendline('reboot')
self.expect(['going down','disconnected'])
self.expect(['going down','disconnected', 'closed'])
try:
self.expect(self.prompt, timeout=10)
except:
Expand All @@ -79,14 +79,16 @@ def reset(self):
try:
pexpect.spawn('ping -w 1 -c 1 ' + self.name).expect('64 bytes', timeout=1)
except:
print(self.name + " not up yet, after %s seconds." % (i + 15))
time.sleep(1)
print(self.name + " not up yet, after %s tries." % (i))
else:
print("%s is back after %s seconds, waiting for network daemons to spawn." % (self.name, i + 14))
print("%s is back after %s tries, waiting for network daemons to spawn." % (self.name, i))
time.sleep(15)
break
self.__init__(self.name, self.color,
self.output, self.username,
self.username,
self.password, self.port,
output=self.output,
reboot=False)

def get_ip_addr(self, interface):
Expand Down
10 changes: 6 additions & 4 deletions devices/non_root_debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def __init__(self,

def reset(self):
self.sendline('sudo reboot')
self.expect(['going down','disconnected'])
self.expect(['going down','disconnected', 'closed'])
try:
self.expect(self.prompt, timeout=10)
except:
Expand All @@ -86,14 +86,16 @@ def reset(self):
try:
pexpect.spawn('ping -w 1 -c 1 ' + self.name).expect('64 bytes', timeout=1)
except:
print(self.name + " not up yet, after %s seconds." % (i + 15))
time.sleep(1)
print(self.name + " not up yet, after %s tries." % (i))
else:
print("%s is back after %s seconds, waiting for network daemons to spawn." % (self.name, i + 14))
print("%s is back after %s tries, waiting for network daemons to spawn." % (self.name, i))
time.sleep(15)
break
self.__init__(self.name, self.color,
self.output, self.username,
self.username,
self.password, self.port,
output=self.output,
reboot=False)

def get_ip_addr(self, interface):
Expand Down

0 comments on commit c64c7e4

Please sign in to comment.