Openstack Horizon: Bug of ‘FileField need clean up temp file….’ or how to remove supefluos files in Horizon/Django after uploading..

After few day envestigation code I created patch. I hope core developers can use it in horizon …

1
2
3
4
5
6
7
8
9
10
11
12
13
14
234 @@ -442,7 +442,12 @@
235                                      {'data': data})
236          else:
237              def upload():
238 -                return glanceclient(request).images.upload(image.id, data)
239 +                glance_answer = glanceclient(request).images.upload(image.id, data)
240 +                if isinstance(data, TemporaryUploadedFile):
241 +                   if glance_answer[0].ok is True :
242 +                      data.file.close_called = False
243 +                      data.file.close()
244 +                return glance_answer
245              thread.start_new_thread(upload, ())
246
247      return Image(image)

Enjoy! Free!

Scroll to top