Ensure we pass a StringIO object to subunit_read

This commit adjusts the retrieve_subunit_v2() method to ensure the
returned buffer is an open "file" just passing the GzipFile object
to subunit2sql doesn't work so this attempts to sidestep the issue
by wrapping the contents of the decompressed file in a cStringIO
object.

Change-Id: I4cf2642e90e7850512c7d51d2375cd5871861c64
This commit is contained in:
Matthew Treinish 2015-10-13 20:25:44 -04:00
parent 468f46722a
commit 65f8c07f06
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177

View File

@ -112,8 +112,10 @@ class SubunitRetriever(threading.Thread):
if gzipped:
logging.debug("Decompressing gzipped source file.")
raw_strIO = cStringIO.StringIO(raw_buf)
buf = gzip.GzipFile(fileobj=raw_strIO)
f = gzip.GzipFile(fileobj=raw_strIO)
buf = cStringIO.StringIO(f.read())
raw_strIO.close()
f.close()
else:
logging.debug("Decoding source file.")
buf = cStringIO.StringIO(raw_buf)