diff options
| 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 |
| commit | bed59cec5e5a9a5668cf2c7df3a24545b1e76c09 (patch) | |
| tree | f7569ff48632187517e5df8dd2d3cb5850691593 /git_config.py | |
| parent | c94d6eb90233421b431adbd5a01b7ec24729a285 (diff) | |
| download | git-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.py | 9 |
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 | |||
| 20 | import json | 20 | import json |
| 21 | import os | 21 | import os |
| 22 | import re | 22 | import re |
| 23 | import ssl | ||
| 23 | import subprocess | 24 | import subprocess |
| 24 | import sys | 25 | import sys |
| 25 | try: | 26 | try: |
| @@ -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. |
