Skip to content

Commit c8c2bee

Browse files
committed
Bugzilla: drop 'extensions' checking for redhat detection
This inserts an API call into class startup for all non-rh bugzilla instances, which isn't very nice. The other detection metric, of the url containing bugzilla.redhat.com, should catch all RH bugzilla instances I know about. If someone needs to trick things beyond that, they can use URL + "?bugzilla.redhat.com" which shouldn't interfere with correct operation of the API Signed-off-by: Cole Robinson <[email protected]>
1 parent 813f564 commit c8c2bee

2 files changed

Lines changed: 7 additions & 21 deletions

File tree

bugzilla/base.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,6 @@ def _detect_is_redhat_bugzilla(self):
269269
log.info("Using RHBugzilla for URL containing bugzilla.redhat.com")
270270
return True
271271

272-
try:
273-
extensions = self._backend.bugzilla_extensions()
274-
if "RedHat" in extensions.get('extensions', {}):
275-
log.info("Found RedHat bugzilla extension, "
276-
"using RHBugzilla")
277-
return True
278-
except Exception:
279-
log.debug("Failed to fetch bugzilla extensions", exc_info=True)
280-
281272
return False
282273

283274
def _init_class_from_url(self):

tests/mockbackend.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414

1515
class BackendMock(_BackendBase):
1616
_version = None
17-
_extensions = None
1817

1918
def bugzilla_version(self):
2019
return {"version": self._version}
21-
def bugzilla_extensions(self):
22-
return self._extensions
2320

2421
def __helper(self, args):
2522
# Grab the calling function name and use it to generate
@@ -107,24 +104,18 @@ def user_update(self, *args):
107104
return self.__helper(args)
108105

109106

110-
def _make_backend_class(version="6.0.0", extensions=None,
111-
rhbz=False, **kwargs):
112-
if not extensions:
113-
extensions = {"extensions": {"foo": {"version": "0.01"}}}
114-
if rhbz:
115-
extensions["extensions"]['RedHat'] = {'version': '0.3'}
107+
def _make_backend_class(version="6.0.0", **kwargs):
116108

117109
class TmpBackendClass(BackendMock):
118110
_version = version
119-
_extensions = extensions
120111

121112
for key, val in kwargs.items():
122113
setattr(TmpBackendClass, "_%s" % key, val)
123114

124115
return TmpBackendClass
125116

126117

127-
def make_bz(bz_kwargs=None, **kwargs):
118+
def make_bz(bz_kwargs=None, rhbz=False, **kwargs):
128119
bz_kwargs = (bz_kwargs or {}).copy()
129120
if "url" in bz_kwargs:
130121
raise RuntimeError("Can't set 'url' in mock make_bz, use connect()")
@@ -135,5 +126,9 @@ def make_bz(bz_kwargs=None, **kwargs):
135126
backendclass = _make_backend_class(**kwargs)
136127
# pylint: disable=protected-access
137128
bz._get_backend_class = lambda *a, **k: backendclass
138-
bz.connect("https:///TESTSUITEMOCK")
129+
130+
url = "https:///TESTSUITEMOCK"
131+
if rhbz:
132+
url += "?fakeredhat=bugzilla.redhat.com"
133+
bz.connect(url)
139134
return bz

0 commit comments

Comments
 (0)