Merge "Strip whitespace from cookie in firmware update" into stable/train

This commit is contained in:
Zuul 2020-03-16 05:44:46 +00:00 committed by Gerrit Code Review
commit bc33c37199
2 changed files with 7 additions and 1 deletions

View File

@ -1109,6 +1109,10 @@ class RIBCLOperations(operations.IloOperations):
LOG.debug(self._('Uploading firmware file: %s ...'), filename)
cookie = fw_img_processor.upload_file_to((self.host, self.port),
self.timeout)
# NOTE(mgoddard): Some devices return a cookie with a newline. This
# breaks header validation in the requests library, which causes the
# update to fail.
cookie = cookie.strip()
LOG.debug(self._('Uploading firmware file: %s ... done'), filename)
root = self._get_firmware_update_xml_for_file_and_component(

View File

@ -818,7 +818,9 @@ class IloRibclTestCase(unittest.TestCase):
def test_update_ilo_firmware(self, _parse_output_mock, _request_ilo_mock,
os_mock, upload_file_to_mock):
# | GIVEN |
upload_file_to_mock.return_value = 'hickory-dickory-dock'
# NOTE(mgoddard): Whitespace should be stripped from the cookie.
# https://launchpad.net/bugs/1859616.
upload_file_to_mock.return_value = ' hickory-dickory-dock'
os_mock.path.getsize.return_value = 12345
# | WHEN |
self.ilo.update_firmware('raw_fw_file.bin', 'ilo')