#2450 serverca property from KojiHubCA web config
Closed 4 years ago by tkopecek. Opened 4 years ago by lrossett.
lrossett/koji kojiweb-ca-fix  into  master

file modified
+11
@@ -58,6 +58,7 @@ 

  import six.moves.urllib

  from requests.adapters import HTTPAdapter

  from requests.packages.urllib3.util.retry import Retry

+ from requests.exceptions import RequestException

  from six.moves import range, zip

  

  from koji.xmlrpcplus import Fault, dumps, getparser, loads, xmlrpc_client
@@ -2771,6 +2772,16 @@ 

                      # (depending on the python version, these may or may not be subclasses of

                      # Exception)

                      raise

+                 except RequestException as e:

+                     _err_res = e.response

+                     _err_req = e.request

+                     if _err_res:

+                         _values = (_err_res.status_code, _err_res.text, str(_err_res))

+                         self.logger.error('Response error: %s::%s::%s' % _values)

+                     else:

+                         _values = (_err_req.method, _err_req.url, str(_err_req))

+                         self.logger.error('Request error: %s::%s::%s' % _values)

+                     raise

                  except Exception as e:

                      tb_str = ''.join(traceback.format_exception(*sys.exc_info()))

                      self.new_session()

file modified
-1
@@ -40,7 +40,6 @@ 

  import traceback

  import zipfile

  from optparse import OptionParser

- 

  import xmlrpc.client

  # urllib is required by the SCM class which is substituted into this file

  # do not remove the import below

file modified
+6 -2
@@ -172,8 +172,12 @@ 

  

  

  def _getServer(environ):

-     opts = environ['koji.options']

-     session = koji.ClientSession(opts['KojiHubURL'])

+     koji_opts = environ['koji.options']

+     opts = {

+         'serverca': koji_opts.get('KojiHubCA', '')

+     }

+ 

+     session = koji.ClientSession(koji_opts['KojiHubURL'], opts=opts)

  

      environ['koji.currentLogin'] = _getUserCookie(environ)

      if environ['koji.currentLogin']:

fixes #2448

Changes

  • sets serverca for session if KojiHubCA is available in environ using an empty string as default value
  • package dependencies update in setup.py

oh it is, I can improve the error message as well if you want to.

pretty please pagure-ci rebuild

4 years ago

2 new commits added

  • requests exception
  • set serverca opts
4 years ago

rebased onto 3fc39e76dd33babe6fc614463bc0814bb241ad3a

4 years ago

pretty please pagure-ci rebuild

4 years ago

rebased onto 657f9d9bdc1aac68f6ceb8478dd632286fc80f69

4 years ago

pretty please pagure-ci rebuild

4 years ago

pretty please pagure-ci rebuild

4 years ago

lol why did the test pass now :-)

it looked like some weird dependency error for librepo just for El7 and F29

OK I see the job changed.. could I get a review again for this PR?

librepo is not installed on all workers in jenkins :-(

I think each job runs in a VM.. so the image being used may need an update.

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

4 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

4 years ago

rebased onto 0a5d1bb

4 years ago

Pull-Request has been closed by tkopecek

4 years ago

This PR includes changes unrelated to the description.

The whitespace change in kojikamid is probably ok, though I prefer to keep pull requests on topic.

However, the change to ClientSession looks like some debug code that accidentally slipped in. This change defeats Koji's retry mechanism in some situations and we'll need to revert that.