Skip to content

Commit

Permalink
Do not translate fsck error messages.
Browse files Browse the repository at this point in the history
We don't translate the text of the other FSError objects that we
raise, and it's kind of wrong to do translation in a task object.

Signed-off-by: mulhern <amulhern@redhat.com>
  • Loading branch information
mulkieran committed Mar 25, 2015
1 parent 57bfe27 commit 38b689e
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions blivet/tasks/fsck.py
Expand Up @@ -24,15 +24,13 @@

from six import add_metaclass

from ..i18n import _, N_

from ..errors import FSError
from .. import util

from . import availability
from . import task

_UNKNOWN_RC_MSG = N_("Unknown return code: %d")
_UNKNOWN_RC_MSG = "Unknown return code: %d"

@add_metaclass(abc.ABCMeta)
class FSCK(task.Task):
Expand Down Expand Up @@ -123,16 +121,16 @@ def doTask(self):

error_msg = self._errorMessage(rc)
if error_msg is not None:
hdr = _("%(type)s filesystem check failure on %(device)s: ") % \
hdr = "%(type)s filesystem check failure on %(device)s: " % \
{"type": self.fs.type, "device": self.fs.device}

raise FSError(hdr + error_msg)


class DosFSCK(FSCK):
_fsckErrors = {1: N_("Recoverable errors have been detected or dosfsck has "
"discovered an internal inconsistency."),
2: N_("Usage error.")}
_fsckErrors = {1: "Recoverable errors have been detected or dosfsck has "
"discovered an internal inconsistency.",
2: "Usage error."}

app_name = "dosfsck"
options = ["-n"]
Expand All @@ -141,24 +139,24 @@ def _errorMessage(self, rc):
if rc < 1:
return None
try:
return _(self._fsckErrors[rc])
return self._fsckErrors[rc]
except KeyError:
return _UNKNOWN_RC_MSG % rc


class Ext2FSCK(FSCK):
_fsckErrors = {4: N_("File system errors left uncorrected."),
8: N_("Operational error."),
16: N_("Usage or syntax error."),
32: N_("e2fsck cancelled by user request."),
128: N_("Shared library error.")}
_fsckErrors = {4: "File system errors left uncorrected.",
8: "Operational error.",
16: "Usage or syntax error.",
32: "e2fsck cancelled by user request.",
128: "Shared library error."}

app_name = "e2fsck"
options = ["-f", "-p", "-C", "0"]

def _errorMessage(self, rc):
msgs = (_(self._fsckErrors[c]) for c in self._fsckErrors.keys() if rc & c)
return "\n".join(msgs).strip() or None
msgs = (self._fsckErrors[c] for c in self._fsckErrors.keys() if rc & c)
return "\n".join(msgs) or None

class HFSPlusFSCK(FSCK):
app_name = "fsck.hfsplus"
Expand Down

0 comments on commit 38b689e

Please sign in to comment.