]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix typo in image_utils tempfile handling
authorVishvananda Ishaya <vishvananda@gmail.com>
Fri, 21 Dec 2012 17:33:22 +0000 (09:33 -0800)
committerVishvananda Ishaya <vishvananda@gmail.com>
Fri, 21 Dec 2012 17:34:51 +0000 (09:34 -0800)
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

cinder/image/image_utils.py

index 8f1251f17ac4b5664eb39adab2aabbe063ab5317..f0d947f126229541ae763bbde939ef60d7825e08 100644 (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)