The blivet-side patches were updated to remove the definition of DirtyFSError in errors.py as it is no longer used anywhere in blivet after the application of the other patches. Otherwise there was no change.
These patches will require updating required blivet version as well.
mulhern (2): Remove allowDirty parameter from mountExistingSystem() call. Remove DirtyFSError related callbacks and entries.
pyanaconda/errors.py | 10 ---- pyanaconda/rescue.py | 133 +++++++++++++++++++++++---------------------------- 2 files changed, 60 insertions(+), 83 deletions(-)
mountExistingSystem() has been re-written so that it behaves as if allowDirty is always True and the parameter has been removed.
Also, remove try/except/else block for DirtyFSError. DirtyFSError is only thrown when allowDirty is False.
This looks like a lot of changes, but everything below the except block is just one big outdent of the body of the else block.
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/rescue.py | 133 +++++++++++++++++++++++---------------------------- 1 file changed, 60 insertions(+), 73 deletions(-)
diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py index 2ee1098..6702e2b 100644 --- a/pyanaconda/rescue.py +++ b/pyanaconda/rescue.py @@ -37,7 +37,7 @@ from pyanaconda.i18n import _ from pyanaconda.kickstart import runPostScripts
from blivet import mountExistingSystem -from blivet.errors import StorageError, DirtyFSError +from blivet.errors import StorageError from blivet.devices import LUKSDevice
from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN @@ -348,81 +348,68 @@ def doRescue(intf, rescue_mount, ksdata): msg = _("Run %s to unmount the system " "when you are finished.") % ANACONDA_CLEANUP
- 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: - ButtonChoiceWindow(intf.screen, _("Rescue"), - _("Your system had dirty file systems which you chose not " - "to mount. Press return to get a shell from which " - "you can fsck and mount your partitions. %s") % msg, - [_("OK")], width = 50) - rootmounted = False + mountExistingSystem(sto.fsset, root.device, readOnly=readOnly) + + if flags.automatedInstall: + log.info("System has been mounted under: %s", iutil.getSysroot()) else: - if flags.automatedInstall: - log.info("System has been mounted under: %s", iutil.getSysroot()) - else: - ButtonChoiceWindow(intf.screen, _("Rescue"), - _("Your system has been mounted under %(rootPath)s.\n\n" - "Press <return> to get a shell. If you would like to " - "make your system the root environment, run the command:\n\n" - "\tchroot %(rootPath)s\n\n%(msg)s") % - {'rootPath': iutil.getSysroot(), - 'msg': msg}, - [_("OK")] ) - rootmounted = True - - # now turn on swap - if not readOnly: - try: - sto.turnOnSwap() - except StorageError: - log.error("Error enabling swap") - - # and selinux too - if flags.selinux: - # we have to catch the possible exception - # because we support read-only mounting - try: - fd = open("%s/.autorelabel" % iutil.getSysroot(), "w+") - fd.close() - except IOError: - log.warning("cannot touch /.autorelabel") - - # set a library path to use mounted fs - libdirs = os.environ.get("LD_LIBRARY_PATH", "").split(":") - mounted = map(lambda dir: "/mnt/sysimage%s" % dir, libdirs) - os.environ["LD_LIBRARY_PATH"] = ":".join(libdirs + mounted) - - # find groff data dir - gversion = None + ButtonChoiceWindow(intf.screen, _("Rescue"), + _("Your system has been mounted under %(rootPath)s.\n\n" + "Press <return> to get a shell. If you would like to " + "make your system the root environment, run the command:\n\n" + "\tchroot %(rootPath)s\n\n%(msg)s") % + {'rootPath': iutil.getSysroot(), + 'msg': msg}, + [_("OK")] ) + rootmounted = True + + # now turn on swap + if not readOnly: try: - glst = os.listdir("/mnt/sysimage/usr/share/groff") - except OSError: - pass - else: - # find a directory which is a numeral, its where - # data files are - for gdir in glst: - if re.match(r'\d[.\d]+\d$', gdir): - gversion = gdir - break - - if gversion is not None: - gpath = "/mnt/sysimage/usr/share/groff/"+gversion - os.environ["GROFF_FONT_PATH"] = gpath + '/font' - os.environ["GROFF_TMAC_PATH"] = "%s:/mnt/sysimage/usr/share/groff/site-tmac" % (gpath + '/tmac',) - - # do we have bash? + sto.turnOnSwap() + except StorageError: + log.error("Error enabling swap") + + # and selinux too + if flags.selinux: + # we have to catch the possible exception + # because we support read-only mounting try: - if os.access("/usr/bin/bash", os.R_OK): - os.symlink ("/usr/bin/bash", "/bin/bash") - except OSError: - pass + fd = open("%s/.autorelabel" % iutil.getSysroot(), "w+") + fd.close() + except IOError: + log.warning("cannot touch /.autorelabel") + + # set a library path to use mounted fs + libdirs = os.environ.get("LD_LIBRARY_PATH", "").split(":") + mounted = map(lambda dir: "/mnt/sysimage%s" % dir, libdirs) + os.environ["LD_LIBRARY_PATH"] = ":".join(libdirs + mounted) + + # find groff data dir + gversion = None + try: + glst = os.listdir("/mnt/sysimage/usr/share/groff") + except OSError: + pass + else: + # find a directory which is a numeral, its where + # data files are + for gdir in glst: + if re.match(r'\d[.\d]+\d$', gdir): + gversion = gdir + break + + if gversion is not None: + gpath = "/mnt/sysimage/usr/share/groff/"+gversion + os.environ["GROFF_FONT_PATH"] = gpath + '/font' + os.environ["GROFF_TMAC_PATH"] = "%s:/mnt/sysimage/usr/share/groff/site-tmac" % (gpath + '/tmac',) + + # do we have bash? + try: + if os.access("/usr/bin/bash", os.R_OK): + os.symlink ("/usr/bin/bash", "/bin/bash") + except OSError: + pass except (ValueError, LookupError, SyntaxError, NameError): raise except Exception as e: # pylint: disable=broad-except
Signed-off-by: mulhern amulhern@redhat.com --- pyanaconda/errors.py | 10 ---------- 1 file changed, 10 deletions(-)
diff --git a/pyanaconda/errors.py b/pyanaconda/errors.py index 00bf055..72c4488 100644 --- a/pyanaconda/errors.py +++ b/pyanaconda/errors.py @@ -127,15 +127,6 @@ class ErrorHandler(object): self.ui.showError(message) return ERROR_RAISE
- def _dirtyFSHandler(self, exn): - message = _("The following file systems for your Linux system were " - "not unmounted cleanly. Would you like to mount them " - "anyway?\n%s") % exn.devices - if self.ui.showYesNoQuestion(message): - return ERROR_CONTINUE - else: - return ERROR_RAISE - def _fstabTypeMismatchHandler(self, exn): # FIXME: include the two types in the message instead of including # the raw exception text @@ -294,7 +285,6 @@ class ErrorHandler(object): _map = {"PartitioningError": self._partitionErrorHandler, "FSResizeError": self._fsResizeHandler, "NoDisksError": self._noDisksHandler, - "DirtyFSError": self._dirtyFSHandler, "FSTabTypeMismatchError": self._fstabTypeMismatchHandler, "InvalidImageSizeError": self._invalidImageSizeHandler, "MissingImageError": self._missingImageHandler,
On Mon, 2015-01-05 at 13:00 -0500, mulhern wrote:
The blivet-side patches were updated to remove the definition of DirtyFSError in errors.py as it is no longer used anywhere in blivet after the application of the other patches. Otherwise there was no change.
These patches will require updating required blivet version as well.
Please amend the change to the first patch that requires it.
mulhern (2): Remove allowDirty parameter from mountExistingSystem() call. Remove DirtyFSError related callbacks and entries.
pyanaconda/errors.py | 10 ---- pyanaconda/rescue.py | 133 +++++++++++++++++++++++---------------------------- 2 files changed, 60 insertions(+), 83 deletions(-)
These both look good to me.
These patches will require updating required blivet version as well.
Please amend the change to the first patch that requires it.
This year, can we all please do a better job of not pushing anaconda patches that bump the requirement on something until that something has been built? Or at the least, push it if your next action will be to build that new something? Otherwise, we get broken tests and if we absolutely have to do a new build of anaconda, we'll be blocked. I have been guilty of this with pykickstart changes too, but I am going to try to do better.
Thanks!
- Chris
anaconda-patches@lists.fedorahosted.org