summaryrefslogtreecommitdiffstats
path: root/git_config.py
diff options
context:
space:
mode:
authorŁukasz Gardoń <garjack555@gmail.com>2017-08-08 10:18:11 +0200
committerŁukasz Gardoń <garjack555@gmail.com>2017-08-23 14:06:14 +0200
commitbed59cec5e5a9a5668cf2c7df3a24545b1e76c09 (patch)
treef7569ff48632187517e5df8dd2d3cb5850691593 /git_config.py
parentc94d6eb90233421b431adbd5a01b7ec24729a285 (diff)
downloadgit-repo-bed59cec5e5a9a5668cf2c7df3a24545b1e76c09.tar.gz
Add option '--no-cert-checks' for 'upload' sub command.
This option allow to bypass verification ssl certification while establishing connection with Gerrit to upload review. Change-Id: If2e15f5a273c18a700eb5093ca8a4d5a4cbf80cd
Diffstat (limited to 'git_config.py')
-rw-r--r--git_config.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/git_config.py b/git_config.py
index e00f6be2..fb4377cf 100644
--- a/git_config.py
+++ b/git_config.py
@@ -20,6 +20,7 @@ import errno
20import json 20import json
21import os 21import os
22import re 22import re
23import ssl
23import subprocess 24import subprocess
24import sys 25import sys
25try: 26try:
@@ -604,7 +605,7 @@ class Remote(object):
604 connectionUrl = self._InsteadOf() 605 connectionUrl = self._InsteadOf()
605 return _preconnect(connectionUrl) 606 return _preconnect(connectionUrl)
606 607
607 def ReviewUrl(self, userEmail): 608 def ReviewUrl(self, userEmail, validate_certs):
608 if self._review_url is None: 609 if self._review_url is None:
609 if self.review is None: 610 if self.review is None:
610 return None 611 return None
@@ -637,7 +638,11 @@ class Remote(object):
637 else: 638 else:
638 try: 639 try:
639 info_url = u + 'ssh_info' 640 info_url = u + 'ssh_info'
640 info = urllib.request.urlopen(info_url).read() 641 if not validate_certs:
642 context = ssl._create_unverified_context()
643 info = urllib.request.urlopen(info_url, context=context).read()
644 else:
645 info = urllib.request.urlopen(info_url).read()
641 if info == 'NOT_AVAILABLE' or '<' in info: 646 if info == 'NOT_AVAILABLE' or '<' in info:
642 # If `info` contains '<', we assume the server gave us some sort 647 # If `info` contains '<', we assume the server gave us some sort
643 # of HTML response back, like maybe a login page. 648 # of HTML response back, like maybe a login page.