Repo should fall back to http, if ssh connection fails for http repos

34 views
Skip to first unread message

Timo Lotterbach

unread,
Jul 15, 2016, 10:45:46 AM7/15/16
to Repo and Gerrit Discussion
Hi everyone,

we have a gerrit server with ssh and https access enabled, but access is limited.
* everyone has access using https
* only some have access using ssh

Users without ssh access can not use "repo upload", since gerrit/ssh_info returns a
configuration, that does not work for them.

Proposal:
Repo should fall back to http, if ssh connection fails for http repos

Patch:

--- a/git_config.py
+++ b/git_config.py
@@ -638,7 +642,11 @@ class Remote(object):
             self._review_url = http_url
           else:
             host, port = info.split()
-            self._review_url = self._SshReviewUrl(userEmail, host, port)
+            ssh_connected = _open_ssh(host, port)
+            if ssh_connected:
+              self._review_url = self._SshReviewUrl(userEmail, host, port)
+            else:
+              self._review_url = http_url
         except urllib.error.HTTPError as e:
           raise UploadError('%s: %s' % (self.review, str(e)))
         except urllib.error.URLError as e:

I'm looking forward to any feedback you have.

Best regards,
Timo

Sven Selberg

unread,
Jul 18, 2016, 2:39:41 AM7/18/16
to Repo and Gerrit Discussion
If you upload your patches to git-repo project for review you will probably get plenty of feedback.

/Sven

Timo Lotterbach

unread,
Jul 18, 2016, 5:05:06 AM7/18/16
to Repo and Gerrit Discussion
Hi Sven,

thanks (again) for your feedback. Sure, I'll do that.

BR, Timo
Reply all
Reply to author
Forward
0 new messages