Comment 9 for bug 1461181

Revision history for this message
Scott Moser (smoser) wrote :

I'd like to see some test / result.
I did verify that simplestreams 'insert_item' does not call reader.close() for you.
the thing that is strange is that this reader has an 'open()' but you don't have to (and don't) close it.
so its kind of odd to expect you to close it.

Perhaps it looks more conventional like this:
--- src/maasserver/bootresources.py 2015-06-02 08:46:21 +0000
+++ src/maasserver/bootresources.py 2015-06-27 01:20:47 +0000
@@ -660,12 +660,14 @@
         # Write the contents into the database, while calculating the sha256
         # hash for the read data.
         with rfile.largefile.content.open('wb') as stream:
+ reader.open()
             while True:
                 buf = reader.read(self.read_size)
                 stream.write(buf)
                 cksummer.update(buf)
                 if len(buf) != self.read_size:
                     break
+ reader.close()

         if not cksummer.check():
             # Calculated sha256 hash from the data does not match, what