fix reading sd blob

TODO: add __enter__ and __exit__ methods to HashBlobReader to let it be
used as a contextmanager
This commit is contained in:
Jack Robison 2017-10-05 15:59:53 -04:00 committed by Kay Kurokawa
parent be78390793
commit d1511cba54
2 changed files with 4 additions and 2 deletions

View file

@ -33,6 +33,7 @@ class HashBlobReader_v0(object):
if self.streaming is False:
reactor.callLater(0, self.producer.resumeProducing)
class HashBlobReader(object):
"""
This is a file like reader class that supports

View file

@ -331,8 +331,9 @@ class ReflectorServer(Protocol):
return d
def determine_missing_blobs(self, sd_blob):
with sd_blob.open_for_reading() as sd_file:
sd_blob_data = sd_file.read()
reader = sd_blob.open_for_reading()
sd_blob_data = reader.read()
reader.close()
decoded_sd_blob = json.loads(sd_blob_data)
return self.get_unvalidated_blobs_in_stream(decoded_sd_blob)