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

Commit c64c7e4

Browse files
authored
Merge pull request qca#6 from ericschultz/prpl_reboot_vms
Fix prpl reboot for VMs
2 parents b56f92d + bf6a616 commit c64c7e4

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

devices/debian.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(self,
6969

7070
def reset(self):
7171
self.sendline('reboot')
72-
self.expect(['going down','disconnected'])
72+
self.expect(['going down','disconnected', 'closed'])
7373
try:
7474
self.expect(self.prompt, timeout=10)
7575
except:
@@ -79,14 +79,16 @@ def reset(self):
7979
try:
8080
pexpect.spawn('ping -w 1 -c 1 ' + self.name).expect('64 bytes', timeout=1)
8181
except:
82-
print(self.name + " not up yet, after %s seconds." % (i + 15))
82+
time.sleep(1)
83+
print(self.name + " not up yet, after %s tries." % (i))
8384
else:
84-
print("%s is back after %s seconds, waiting for network daemons to spawn." % (self.name, i + 14))
85+
print("%s is back after %s tries, waiting for network daemons to spawn." % (self.name, i))
8586
time.sleep(15)
8687
break
8788
self.__init__(self.name, self.color,
88-
self.output, self.username,
89+
self.username,
8990
self.password, self.port,
91+
output=self.output,
9092
reboot=False)
9193

9294
def get_ip_addr(self, interface):

devices/non_root_debian.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __init__(self,
7676

7777
def reset(self):
7878
self.sendline('sudo reboot')
79-
self.expect(['going down','disconnected'])
79+
self.expect(['going down','disconnected', 'closed'])
8080
try:
8181
self.expect(self.prompt, timeout=10)
8282
except:
@@ -86,14 +86,16 @@ def reset(self):
8686
try:
8787
pexpect.spawn('ping -w 1 -c 1 ' + self.name).expect('64 bytes', timeout=1)
8888
except:
89-
print(self.name + " not up yet, after %s seconds." % (i + 15))
89+
time.sleep(1)
90+
print(self.name + " not up yet, after %s tries." % (i))
9091
else:
91-
print("%s is back after %s seconds, waiting for network daemons to spawn." % (self.name, i + 14))
92+
print("%s is back after %s tries, waiting for network daemons to spawn." % (self.name, i))
9293
time.sleep(15)
9394
break
9495
self.__init__(self.name, self.color,
95-
self.output, self.username,
96+
self.username,
9697
self.password, self.port,
98+
output=self.output,
9799
reboot=False)
98100

99101
def get_ip_addr(self, interface):

0 commit comments

Comments
 (0)