automatically retry connect with allow_agent=False

This seems to be a common reason a connect failure happens.
Explicitly trying again with allow_agent=False may make it work.

Change-Id: If14a9f9eb0d6f707e4f939cb96ab5f6c4844a541
This commit is contained in:
Russell Bryant 2014-03-25 05:12:21 -04:00
parent e83704eb62
commit 6687a12e4e
1 changed files with 7 additions and 2 deletions

View File

@ -88,8 +88,13 @@ def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
if not changes:
while True:
client.connect(server, port=29418,
key_filename=ssh_key, username=ssh_user)
try:
client.connect(server, port=29418,
key_filename=ssh_key, username=ssh_user)
except paramiko.SSHException:
client.connect(server, port=29418,
key_filename=ssh_key, username=ssh_user,
allow_agent=False)
cmd = ('gerrit query %s --all-approvals --patch-sets '
'--format JSON' % projects_q(project))
if only_open: