[master][PATCH] mountExistingSystem raises an exception with dirty FS (#1080210)

Vratislav Podzimek vpodzime at redhat.com
Tue Mar 25 12:57:44 UTC 2014


The commit 3ca0ae5e155 removed the rc variable that had always been being set to
None because mountExistingSystem didn't return any value. However, the variable
was left in place in the next block testing it for being -1 or something else.

Put mountExistingSystem call in a try-except block and catch the DirstFSError
exception instead.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/rescue.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index ff74f6b..c740dc3 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -29,7 +29,7 @@ import sys
 import os
 import isys
 from blivet import mountExistingSystem
-from blivet.errors import StorageError
+from blivet.errors import StorageError, DirtyFSError
 from installinterfacebase import InstallInterfaceBase
 import iutil
 import shutil
@@ -356,11 +356,6 @@ def doRescue(intf, rescue_mount, ksdata):
 
     if root:
         try:
-            # TODO: add a callback to warn about dirty filesystems
-            mountExistingSystem(sto.fsset, root.device,
-                                allowDirty = True,
-                                readOnly = readOnly)
-
             if not flags.imageInstall:
                 msg = _("The system will reboot automatically when you exit "
                         "from the shell.")
@@ -368,7 +363,11 @@ def doRescue(intf, rescue_mount, ksdata):
                 msg = _("Run %s to unmount the system "
                         "when you are finished.") % ANACONDA_CLEANUP
 
-            if rc == -1:
+            try:
+                mountExistingSystem(sto.fsset, root.device,
+                                    allowDirty = True,
+                                    readOnly = readOnly)
+            except DirtyFSError:
                 if flags.automatedInstall:
                     log.error("System had dirty file systems which you chose not to mount")
                 else:
-- 
1.8.5.3



More information about the anaconda-patches mailing list