[PATCH] imgutils: fix umount retry handling

Brian C. Lane bcl at redhat.com
Mon Aug 20 23:50:49 UTC 2012


From: "Brian C. Lane" <bcl at redhat.com>

When umount fails it doesn't throw an error, so retry when the rv is
non-zero instead.
---
 src/pylorax/imgutils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/pylorax/imgutils.py b/src/pylorax/imgutils.py
index 8da4b8c..6a6c40f 100644
--- a/src/pylorax/imgutils.py
+++ b/src/pylorax/imgutils.py
@@ -128,7 +128,12 @@ def umount(mnt,  lazy=False, maxretry=3, retrysleep=1.0):
     while maxretry > 0:
         try:
             rv = execWithRedirect(umount[0], umount[1:])
-        except CalledProcessError:
+        except Exception:
+            # execWithRedirect will log what the errors was, so we can just
+            # ignore it and retry.
+            pass
+
+        if rv != 0:
             count += 1
             if count == maxretry:
                 raise
-- 
1.7.11.2



More information about the anaconda-patches mailing list