Skip to content

Commit 5db4ea2

Browse files
committed
Bugzilla: Tweak URL logging a bit
Because we call fix_url multiple times internally, the logging there is noisy. Instead centralize relevant logging in connect() Signed-off-by: Cole Robinson <[email protected]>
1 parent 583481b commit 5db4ea2

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

bugzilla/_cli.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,9 +1104,6 @@ def _main(unittest_bz_instance):
11041104
log.debug("Launched with command line: %s", " ".join(sys.argv))
11051105
log.debug("Bugzilla module: %s", bugzilla)
11061106

1107-
# Connect to bugzilla
1108-
log.info('Connecting to %s', opt.bugzilla)
1109-
11101107
if unittest_bz_instance:
11111108
bz = unittest_bz_instance
11121109
else:

bugzilla/base.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ def fix_url(url, force_rest=False):
143143
"""
144144
scheme, netloc, path, params, query, fragment = urlparse(url)
145145
if not scheme:
146-
log.debug('No scheme given for url, assuming https')
147146
scheme = 'https'
148147

149148
if path and not netloc:
@@ -154,11 +153,8 @@ def fix_url(url, force_rest=False):
154153
path = 'xmlrpc.cgi'
155154
if force_rest:
156155
path = "rest/"
157-
log.debug('No path given for url, assuming /%s', path)
158156

159157
newurl = urlunparse((scheme, netloc, path, params, query, fragment))
160-
if newurl != url:
161-
log.debug("Generated fixed URL: %s", newurl)
162158
return newurl
163159

164160
@staticmethod
@@ -499,19 +495,24 @@ def connect(self, url=None):
499495
if self._session:
500496
self.disconnect()
501497

502-
backendclass, url = self._get_backend_class(url or self.url)
503-
self.url = url
498+
url = url or self.url
499+
backendclass, newurl = self._get_backend_class(url)
500+
if url != newurl:
501+
log.debug("Converted url=%s to fixed url=%s", url, newurl)
502+
self.url = newurl
503+
log.debug("Connecting with URL %s", self.url)
504+
504505
# we've changed URLs - reload config
505506
self.readconfig(overwrite=False)
506507

507-
self._session = _BugzillaSession(url, self.user_agent,
508+
self._session = _BugzillaSession(self.url, self.user_agent,
508509
cookiecache=self._cookiecache,
509510
sslverify=self._sslverify,
510511
cert=self.cert,
511512
tokencache=self._tokencache,
512513
api_key=self.api_key,
513514
requests_session=self._user_requests_session)
514-
self._backend = backendclass(url, self._session)
515+
self._backend = backendclass(self.url, self._session)
515516

516517
if (self.user and self.password):
517518
log.info("user and password present - doing login()")

0 commit comments

Comments
 (0)