Skip to content

Commit

Permalink
Allow to skip SSL verification in bugzilla plugin
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
sandrobonazzola committed Sep 27, 2024
1 parent 7bba797 commit fca671d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions did/plugins/bugzilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
type = bugzilla
prefix = BZ
url = https://bugzilla.redhat.com/xmlrpc.cgi
ssl_verify = True
resolutions = notabug, duplicate
Resolutions:
Expand Down Expand Up @@ -48,19 +49,22 @@

from did.base import Config, ReportError
from did.stats import Stats, StatsGroup
from did.utils import log, pretty, split
from did.utils import log, pretty, split, strtobool

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Constants
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

DEFAULT_RESOLUTIONS = ["notabug", "duplicate"]

# Enable ssl verify
SSL_VERIFY = True

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Bugzilla
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


class Bugzilla(object):
""" Bugzilla investigator """

Expand All @@ -73,7 +77,10 @@ def __init__(self, parent):
def server(self):
""" Connection to the server """
if self._server is None:
self._server = bugzilla.Bugzilla(url=self.parent.url)
self._server = bugzilla.Bugzilla(
url=self.parent.url,
sslverify=self.parent.ssl_verify
)
return self._server

def search(self, query, options):
Expand Down Expand Up @@ -645,6 +652,18 @@ def __init__(self, option, name=None, parent=None, user=None):
except KeyError:
raise ReportError(
"No bugzilla url set in the [{0}] section".format(option))

# SSL verification
if "ssl_verify" in config:
try:
self.ssl_verify = strtobool(
config["ssl_verify"])
except Exception as error:
raise ReportError(
"Error when parsing 'ssl_verify': {0}".format(error))
else:
self.ssl_verify = SSL_VERIFY

# Make sure we have prefix set
try:
self.prefix = config["prefix"]
Expand Down

0 comments on commit fca671d

Please sign in to comment.