Skip to content

Commit

Permalink
Correctly handle IncompleteRead in the Composer.
Browse files Browse the repository at this point in the history
fixes #2758

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
(cherry picked from commit 38cd7df)
  • Loading branch information
bowlofeggs authored and mergify[bot] committed Dec 3, 2018
1 parent a9b8e69 commit a96c17a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bodhi/server/consumers/masher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,11 +1325,11 @@ def _wait_for_sync(self):
try:
self.log.info('Polling %s' % master_repomd_url)
masterrepomd = urllib2.urlopen(master_repomd_url)
newsum = hashlib.sha1(masterrepomd.read()).hexdigest()
except (IncompleteRead, URLError, HTTPError):
self.log.exception('Error fetching repomd.xml')
time.sleep(200)
continue
newsum = hashlib.sha1(masterrepomd.read()).hexdigest()
if newsum == checksum:
self.log.info("master repomd.xml matches!")
notifications.publish(
Expand Down
14 changes: 7 additions & 7 deletions bodhi/tests/server/consumers/test_masher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3105,9 +3105,7 @@ def test_incompleteread(self, urlopen, sleep, publish, save):
"""
Assert that an IncompleteRead is properly caught and logged, and that the code continues.
"""
fake_url = mock.MagicMock()
fake_url.read.return_value = b'---\nyaml: rules'
urlopen.side_effect = [IncompleteRead('some_data'), fake_url]
urlopen.return_value.read.side_effect = [IncompleteRead('some_data'), b'---\nyaml: rules']
t = PungiComposerThread(self.semmock, self._make_msg()['body']['msg']['composes'][0],
'bowlofeggs', log, self.Session, self.tempdir)
t.compose = self.db.query(Compose).one()
Expand All @@ -3132,10 +3130,12 @@ def test_incompleteread(self, urlopen, sleep, publish, save):
# won't be deterministic about which of arch URL gets used. However, either one of them
# would be correct so we will just assert that the one that is used is used correctly.
arch = 'x86_64' if 'x86_64' in urlopen.mock_calls[0][1][0] else 'aarch64'
expected_calls = [
mock.call('http://example.com/pub/fedora/linux/updates/testing/17/'
'{}/repodata.repomd.xml'.format(arch))
for i in range(2)]
expected_calls = []
for i in range(2):
expected_calls.append(
mock.call('http://example.com/pub/fedora/linux/updates/testing/17/'
'{}/repodata.repomd.xml'.format(arch)))
expected_calls.append(mock.call().read())
urlopen.assert_has_calls(expected_calls)
t.log.exception.assert_called_once_with('Error fetching repomd.xml')
sleep.assert_called_once_with(200)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
# The short X.Y version.
version = '3.11'
# The full version, including alpha/beta/rc tags.
release = '3.11.1'
release = '3.11.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
26 changes: 26 additions & 0 deletions docs/user/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
Release notes
=============

v3.11.2
-------

This is a bugfix release, addressing an issue that was solved incorrectly with 3.11.1.


Server upgrade instructions
^^^^^^^^^^^^^^^^^^^^^^^^^^^

No special actions are needed when applying this update.


Bug fixes
^^^^^^^^^

* Correctly catch ``http.client.IncompleteRead`` while Composing and retry (:issue:`2758`).


Contributors
^^^^^^^^^^^^

The following developers contributed to Bodhi 3.11.2:

* Randy Barlow


v3.11.1
-------

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_requirements(requirements_file='requirements.txt'):

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
VERSION = '3.11.1'
VERSION = '3.11.2'
# Possible options are at https://pypi.python.org/pypi?%3Aaction=list_classifiers
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit a96c17a

Please sign in to comment.