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
This commit is contained in:
parent
c94d6eb902
commit
bed59cec5e
3 changed files with 20 additions and 7 deletions
|
@ -20,6 +20,7 @@ import errno
|
|||
import json
|
||||
import os
|
||||
import re
|
||||
import ssl
|
||||
import subprocess
|
||||
import sys
|
||||
try:
|
||||
|
@ -604,7 +605,7 @@ class Remote(object):
|
|||
connectionUrl = self._InsteadOf()
|
||||
return _preconnect(connectionUrl)
|
||||
|
||||
def ReviewUrl(self, userEmail):
|
||||
def ReviewUrl(self, userEmail, validate_certs):
|
||||
if self._review_url is None:
|
||||
if self.review is None:
|
||||
return None
|
||||
|
@ -637,7 +638,11 @@ class Remote(object):
|
|||
else:
|
||||
try:
|
||||
info_url = u + 'ssh_info'
|
||||
info = urllib.request.urlopen(info_url).read()
|
||||
if not validate_certs:
|
||||
context = ssl._create_unverified_context()
|
||||
info = urllib.request.urlopen(info_url, context=context).read()
|
||||
else:
|
||||
info = urllib.request.urlopen(info_url).read()
|
||||
if info == 'NOT_AVAILABLE' or '<' in info:
|
||||
# If `info` contains '<', we assume the server gave us some sort
|
||||
# of HTML response back, like maybe a login page.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue