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 Oct 7, 2024
1 parent 5aa40dc commit c32de53
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 @@ -16,6 +16,7 @@
type = bugzilla
prefix = BZ
url = https://bugzilla.redhat.com/xmlrpc.cgi
ssl_verify = True
resolutions = notabug, duplicate
Resolutions:
Expand Down Expand Up @@ -46,19 +47,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 @@ -71,7 +75,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 @@ -643,6 +650,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 c32de53

Please sign in to comment.