Fix typo in image_utils tempfile handling

Commit cbcd340 changed from NamedTemporaryFile to mkstemp, but
mkstemp returns a file descripter, not a file object. We therefore
need to close the fd using os.close(). This was tested using
devstack.

Change-Id: I808fa470a141e249fe30ee762ee94f47ecfd3f63
This commit is contained in:
Vishvananda Ishaya
2012-12-21 09:33:22 -08:00
parent cbcd340c67
commit c2e9e2f378

View File

@@ -209,7 +209,7 @@ def fetch_to_raw(context, image_service,
os.makedirs(FLAGS.image_conversion_dir)
fd, tmp = tempfile.mkstemp(dir=FLAGS.image_conversion_dir)
fd.close()
os.close(fd)
with utils.remove_path_on_error(tmp):
fetch(context, image_service, image_id, tmp, user_id, project_id)