nicolas-r / katello-centos-errata-import

Imports CentOS (from http://cefs.steve-meier.de/) errata into Katello
28 stars 11 forks source link

Katello 3.17 import fails with HTTP error 502 when getting the package list #12

Closed ronnybremer closed 3 years ago

ronnybremer commented 3 years ago

I am trying to implement the import script with Katello 3.17 and was able to get everything set up. However, upon import I get an python traceback:

2020-12-01 18:03:39,079 :: INFO :: Get errata packages data for the selected repositories...
2020-12-01 18:03:39,084 :: DEBUG :: Starting new HTTPS connection (1): foreman.local.lan:443
2020-12-01 18:03:39,392 :: DEBUG :: https://foreman.local.lan:443 "GET /katello/api/v2/errata?per_page=99999 HTTP/1.1" 200 115
2020-12-01 18:03:39,400 :: DEBUG :: Starting new HTTPS connection (1): foreman.local.lan:443
2020-12-01 18:04:39,511 :: DEBUG :: https://foreman.local.lan:443 "GET /katello/api/v2/packages?per_page=99999 HTTP/1.1" 502 425
Traceback (most recent call last):
  File "./centos-errata-katello-importer.py", line 117, in <module>
    rpms = katello.get_repository_packages(all_repositories[repo_release][repo]['id'])
  File "/opt/katello-centos-errata-import/modules/katelloerrata/katello.py", line 97, in get_repository_packages
    return(self._get_json('packages', data, None))
  File "/opt/katello-centos-errata-import/modules/katelloerrata/katello.py", line 61, in _get_json
    return r.json()
  File "/usr/lib/python3.6/site-packages/requests/models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I assume the HTTP error 502 is not expected. I cannot find anything in a log which could explain the bad gateway error. Have you seen this before?

danoe commented 3 years ago

I think for me it was due to a timeout. You can try setting in /etc//httpd/conf/httpd.conf Timeout 600 I think the default value is 60.

ronnybremer commented 3 years ago

Thank you for your suggestion. I changed the timeout to 600 seconds and no longer see the 502 HTTP error. Perfect :)