Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions soloutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ def _connect(ip, await=True, silent=False):
socket.setdefaulttimeout(5)
message = silent
start = time.time()
tryCount = 0
while True:

if (tryCount >= 5):
print 'error: unable to connect after {} attempts, giving up.'.format(tryCount)
sys.exit(1)

tryCount = tryCount + 1

try:
client.connect(ip, username='root', password='TjSDBkAu', timeout=5)
except paramiko.BadHostKeyException:
Expand All @@ -39,15 +47,18 @@ def _connect(ip, await=True, silent=False):
print ''
print 'and try again'
sys.exit(1)
except paramiko.AuthenticationException as e:
print 'ssh authentication error'
raise e
except Exception as e:
if not await:
raise e
if not message and time.time() - start > 5:
if not message and time.time() - start > 2:
message = True
print '(note: ensure you are connected to Solo\'s wifi network.)'
client.close()
time.sleep(1)
continue
time.sleep(1)
break
socket.setdefaulttimeout(None)

Expand Down