Skip to content

Commit 0d15507

Browse files
Allow to skip SSL verification in bugzilla plugin
Recently Red Hat bugzilla SSL certificate is failing verification. In order to allow querying bugzilla while this issue is getting fixed, allowing to skip SSL certificate validation. Signed-off-by: Sandro Bonazzola <[email protected]>
1 parent 0623bf0 commit 0d15507

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

did/plugins/bugzilla.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
type = bugzilla
1717
prefix = BZ
1818
url = https://bugzilla.redhat.com/xmlrpc.cgi
19+
ssl_verify = True
1920
resolutions = notabug, duplicate
2021
2122
Resolutions:
@@ -46,19 +47,22 @@
4647

4748
from did.base import Config, ReportError
4849
from did.stats import Stats, StatsGroup
49-
from did.utils import log, pretty, split
50+
from did.utils import log, pretty, split, strtobool
5051

5152
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5253
# Constants
5354
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5455

5556
DEFAULT_RESOLUTIONS = ["notabug", "duplicate"]
5657

58+
# Enable ssl verify
59+
SSL_VERIFY = True
5760

5861
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5962
# Bugzilla
6063
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6164

65+
6266
class Bugzilla(object):
6367
""" Bugzilla investigator """
6468

@@ -71,7 +75,10 @@ def __init__(self, parent):
7175
def server(self):
7276
""" Connection to the server """
7377
if self._server is None:
74-
self._server = bugzilla.Bugzilla(url=self.parent.url)
78+
self._server = bugzilla.Bugzilla(
79+
url=self.parent.url,
80+
sslverify=self.parent.ssl_verify
81+
)
7582
return self._server
7683

7784
def search(self, query, options):
@@ -643,6 +650,18 @@ def __init__(self, option, name=None, parent=None, user=None):
643650
except KeyError:
644651
raise ReportError(
645652
"No bugzilla url set in the [{0}] section".format(option))
653+
654+
# SSL verification
655+
if "ssl_verify" in config:
656+
try:
657+
self.ssl_verify = strtobool(
658+
config["ssl_verify"])
659+
except Exception as error:
660+
raise ReportError(
661+
"Error when parsing 'ssl_verify': {0}".format(error))
662+
else:
663+
self.ssl_verify = SSL_VERIFY
664+
646665
# Make sure we have prefix set
647666
try:
648667
self.prefix = config["prefix"]

0 commit comments

Comments
 (0)