| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 657f011 commit 4af4748
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,9 +61,10 @@ parameters. You can override the values in each GitLab server section. | |||
| 61 | 61 | - Possible values | |
| 62 | 62 | - Description | |
| 63 | 63 | * - ``ssl_verify`` | |
| 64 | - - ``True`` or ``False`` | ||
| 65 | - - Verify the SSL certificate. Set to ``False`` if your SSL certificate is | ||
| 66 | - auto-signed. | ||
| 64 | + - ``True``, ``False``, or a ``str`` | ||
| 65 | + - Verify the SSL certificate. Set to ``False`` to disable verification, | ||
| 66 | + though this will create warnings. Any other value is interpreted as path | ||
| 67 | + to a CA_BUNDLE file or directory with certificates of trusted CAs. | ||
| 67 | 68 | * - ``timeout`` | |
| 68 | 69 | - Integer | |
| 69 | 70 | - Number of seconds to wait for an answer before failing. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,11 +61,28 @@ def __init__(self, gitlab_id=None, config_files=None): | |||
| 61 | 61 | self.ssl_verify = True | |
| 62 | 62 | try: | |
| 63 | 63 | self.ssl_verify = self._config.getboolean('global', 'ssl_verify') | |
| 64 | + except ValueError: | ||
| 65 | + # Value Error means the option exists but isn't a boolean. | ||
| 66 | + # Get as a string instead as it should then be a local path to a | ||
| 67 | + # CA bundle. | ||
| 68 | + try: | ||
| 69 | + self.ssl_verify = self._config.get('global', 'ssl_verify') | ||
| 70 | + except Exception: | ||
| 71 | + pass | ||
| 64 | 72 | except Exception: | |
| 65 | 73 | pass | |
| 66 | 74 | try: | |
| 67 | 75 | self.ssl_verify = self._config.getboolean(self.gitlab_id, | |
| 68 | 76 | 'ssl_verify') | |
| 77 | + except ValueError: | ||
| 78 | + # Value Error means the option exists but isn't a boolean. | ||
| 79 | + # Get as a string instead as it should then be a local path to a | ||
| 80 | + # CA bundle. | ||
| 81 | + try: | ||
| 82 | + self.ssl_verify = self._config.get(self.gitlab_id, | ||
| 83 | + 'ssl_verify') | ||
| 84 | + except Exception: | ||
| 85 | + pass | ||
| 69 | 86 | except Exception: | |
| 70 | 87 | pass | |
| 71 | 88 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,11 @@ | |||
| 40 | 40 | private_token = GHIJKL | |
| 41 | 41 | ssl_verify = false | |
| 42 | 42 | timeout = 10 | |
| 43 | + | ||
| 44 | + [three] | ||
| 45 | + url = https://three.url | ||
| 46 | + private_token = MNOPQR | ||
| 47 | + ssl_verify = /path/to/CA/bundle.crt | ||
| 43 | 48 | """ | |
| 44 | 49 | ||
| 45 | 50 | no_default_config = u"""[global] | |
@@ -109,3 +114,13 @@ def test_valid_data(self, m_open): | |||
| 109 | 114 | self.assertEqual("GHIJKL", cp.token) | |
| 110 | 115 | self.assertEqual(10, cp.timeout) | |
| 111 | 116 | self.assertEqual(False, cp.ssl_verify) | |
| 117 | + | ||
| 118 | + fd = six.StringIO(valid_config) | ||
| 119 | + fd.close = mock.Mock(return_value=None) | ||
| 120 | + m_open.return_value = fd | ||
| 121 | + cp = config.GitlabConfigParser(gitlab_id="three") | ||
| 122 | + self.assertEqual("three", cp.gitlab_id) | ||
| 123 | + self.assertEqual("https://three.url", cp.url) | ||
| 124 | + self.assertEqual("MNOPQR", cp.token) | ||
| 125 | + self.assertEqual(2, cp.timeout) | ||
| 126 | + self.assertEqual("/path/to/CA/bundle.crt", cp.ssl_verify) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments