[master/rhel7] Ensure media being verified is always unmounted

David Shea dshea at redhat.com
Mon Feb 24 19:26:53 UTC 2014


Exceptions raised in verifyMedia could cause rmdir to be called on the
temporary mountpoint before the media is unmounted, causing another
error.

Resolves: rhbz#1050943
---
 pyanaconda/image.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/image.py b/pyanaconda/image.py
index 3c154d3..159583f 100644
--- a/pyanaconda/image.py
+++ b/pyanaconda/image.py
@@ -209,11 +209,14 @@ def opticalInstallMedia(devicetree):
             except FSError:
                 continue
 
-            if not verifyMedia(mountpoint):
-                dev.format.unmount()
-                continue
+            try:
+                if not verifyMedia(mountpoint):
+                    dev.format.unmount()
+                    continue
 
-            dev.format.unmount()
+                dev.format.unmount()
+            finally:
+                dev.format.unmount()
         finally:
             os.rmdir(mountpoint)
 
-- 
1.8.5.3



More information about the anaconda-patches mailing list