diff --git a/did/plugins/bugzilla.py b/did/plugins/bugzilla.py index 8e6fefdb..0bd94aac 100644 --- a/did/plugins/bugzilla.py +++ b/did/plugins/bugzilla.py @@ -18,6 +18,7 @@ type = bugzilla prefix = BZ url = https://bugzilla.redhat.com/xmlrpc.cgi + ssl_verify = True resolutions = notabug, duplicate Resolutions: @@ -48,7 +49,7 @@ 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 @@ -56,11 +57,14 @@ DEFAULT_RESOLUTIONS = ["notabug", "duplicate"] +# Enable ssl verify +SSL_VERIFY = True # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Bugzilla # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + class Bugzilla(object): """ Bugzilla investigator """ @@ -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): @@ -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"]