Re: [PATCH 1/3] Do not translate exception messages in storage/zfcp.py.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 17 Oct 2009, Steffen Maier wrote:

Nack.

ValueErrors end up in the UI and the user gets to see them during
installation (*without* looking into /tmp/anaconda.log).

Right, my mistake.  This patch was after I'd been seeing a lot of log.*()
calls with translated messages inside them.  *Those* are what I want to avoid.

Just because in some cases (parm/conf file or kickstart) the messages do
not get to the UI and are only logged does not seem to justify removing
the translations altogether.

Yes it does.  We don't want translated messages in the log files simply
because it makes finding the problem code more difficult.  Translated messages
for the UI are a different story.

iw/autopart_type.py-429-            fcplun = dxml.get_widget("fcplunEntry").get_text().strip()
iw/autopart_type.py-430-
iw/autopart_type.py-431-            try:
iw/autopart_type.py:432:                self.storage.zfcp.addFCP(devnum, wwpn, fcplun)
iw/autopart_type.py-433-            except ValueError, e:
iw/autopart_type.py-434-                self.intf.messageWindow(_("Error"), str(e))
iw/autopart_type.py-435-                continue

commit f13f934cc9a8898b996731fbb950048ba3fbbc6d
Author: Steffen Maier <maier@xxxxxxxxxxxxxxxxxx>
Date:   Fri Jul 10 10:19:40 2009 -1000

   error messages of zFCP on s390: log or pass to the UI

Looking back at this patch, I forsee problems with us being able to work bugs
filed by users if translated messages are ending up in the logs.

On 10/17/2009 05:52 AM, David Cantrell wrote:
---
 storage/zfcp.py |   67 ++++++++++++++++++++++++++----------------------------
 1 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/storage/zfcp.py b/storage/zfcp.py
index 47271b9..a1e5606 100644
--- a/storage/zfcp.py
+++ b/storage/zfcp.py
@@ -47,11 +47,11 @@ class ZFCPDevice:
         self.fcplun = self.sanitizeFCPLInput(fcplun)

         if not self.checkValidDevice(self.devnum):
-            raise ValueError, _("You have not specified a device number or the number is invalid")
+            raise ValueError, "You have not specified a device number or the number is invalid"
         if not self.checkValidWWPN(self.wwpn):
-            raise ValueError, _("You have not specified a worldwide port name or the name is invalid.")
+            raise ValueError, "You have not specified a worldwide port name or the name is invalid."
         if not self.checkValidFCPLun(self.fcplun):
-            raise ValueError, _("You have not specified a FCP LUN or the number is invalid.")
+            raise ValueError, "You have not specified a FCP LUN or the number is invalid."

     def __str__(self):
         return "%s %s %s" %(self.devnum, self.wwpn, self.fcplun)
@@ -128,14 +128,13 @@ class ZFCPDevice:
                                       "free %s" %(self.devnum,))
                 udev_settle()
         except IOError as e:
-            raise ValueError, _("Could not free zFCP device %(devnum)s from "
-                                "device ignore list (%(e)s).") \
+            raise ValueError, "Could not free zFCP device %(devnum)s from " \
+                              "device ignore list (%(e)s)." \
                               % {'devnum': self.devnum, 'e': e}

         if not os.path.exists(online):
-            raise ValueError, _(
-                "zFCP device %s not found, not even in device ignore list."
-                %(self.devnum,))
+            raise ValueError, "zFCP device %s not found, not even in device " \
+                              "ignore list." % (self.devnum,)

         try:
             f = open(online, "r")
@@ -146,8 +145,8 @@ class ZFCPDevice:
             else:
                 log.info("zFCP device %s already online." %(self.devnum,))
         except IOError as e:
-            raise ValueError, _("Could not set zFCP device %(devnum)s "
-                                "online (%(e)s).") \
+            raise ValueError, "Could not set zFCP device %(devnum)s " \
+                              "online (%(e)s)." \
                               % {'devnum': self.devnum, 'e': e}

         if not os.path.exists(portdir):
@@ -157,16 +156,16 @@ class ZFCPDevice:
                     loggedWriteLineToFile(portadd, self.wwpn)
                     udev_settle()
                 except IOError as e:
-                    raise ValueError, _("Could not add WWPN %(wwpn)s to zFCP "
-                                        "device %(devnum)s (%(e)s).") \
+                    raise ValueError, "Could not add WWPN %(wwpn)s to zFCP " \
+                                      "device %(devnum)s (%(e)s)." \
                                       % {'wwpn': self.wwpn,
                                          'devnum': self.devnum,
                                          'e': e}
             else:
                 # newer zfcp sysfs interface with auto port scan
-                raise ValueError, _("WWPN %(wwpn)s not found at zFCP device "
-                                    "%(devnum)s.") % {'wwpn': self.wwpn,
-                                                      'devnum': self.devnum}
+                raise ValueError, "WWPN %(wwpn)s not found at zFCP device " \
+                                  "%(devnum)s." % {'wwpn': self.wwpn,
+                                                   'devnum': self.devnum}
         else:
             if os.path.exists(portadd):
                 # older zfcp sysfs interface
@@ -179,14 +178,14 @@ class ZFCPDevice:
                 loggedWriteLineToFile(unitadd, self.fcplun)
                 udev_settle()
             except IOError as e:
-                raise ValueError, _("Could not add LUN %(fcplun)s to WWPN "
-                                    "%(wwpn)s on zFCP device %(devnum)s "
-                                    "(%(e)s).") \
+                raise ValueError, "Could not add LUN %(fcplun)s to WWPN " \
+                                  "%(wwpn)s on zFCP device %(devnum)s " \
+                                  "(%(e)s)." \
                                   % {'fcplun': self.fcplun, 'wwpn': self.wwpn,
                                      'devnum': self.devnum, 'e': e}
         else:
-            raise ValueError, _("LUN %(fcplun)s at WWPN %(wwpn)s on zFCP "
-                                "device %(devnum)s already configured.") \
+            raise ValueError, "LUN %(fcplun)s at WWPN %(wwpn)s on zFCP " \
+                              "device %(devnum)s already configured." \
                               % {'fcplun': self.fcplun,
                                  'wwpn': self.wwpn,
                                  'devnum': self.devnum}
@@ -197,17 +196,17 @@ class ZFCPDevice:
             fail = f.readline().strip()
             f.close()
         except IOError as e:
-            raise ValueError, _("Could not read failed attribute of LUN "
-                                "%(fcplun)s at WWPN %(wwpn)s on zFCP device "
-                                "%(devnum)s (%(e)s).") \
+            raise ValueError, "Could not read failed attribute of LUN " \
+                              "%(fcplun)s at WWPN %(wwpn)s on zFCP device " \
+                              "%(devnum)s (%(e)s)." \
                               % {'fcplun': self.fcplun,
                                  'wwpn': self.wwpn,
                                  'devnum': self.devnum,
                                  'e': e}
         if fail != "0":
             self.offlineDevice()
-            raise ValueError, _("Failed LUN %(fcplun)s at WWPN %(wwpn)s on "
-                                "zFCP device %(devnum)s removed again.") \
+            raise ValueError, "Failed LUN %(fcplun)s at WWPN %(wwpn)s on " \
+                              "zFCP device %(devnum)s removed again." \
                               % {'fcplun': self.fcplun,
                                  'wwpn': self.wwpn,
                                  'devnum': self.devnum}
@@ -263,18 +262,16 @@ class ZFCPDevice:
         try:
             self.offlineSCSIDevice()
         except IOError as e:
-            raise ValueError, _("Could not correctly delete SCSI device of "
-                                "zFCP %(devnum)s %(wwpn)s %(fcplun)s "
-                                "(%(e)s).") \
+            raise ValueError, "Could not correctly delete SCSI device of " \
+                              "zFCP %(devnum)s %(wwpn)s %(fcplun)s (%(e)s)." \
                               % {'devnum': self.devnum, 'wwpn': self.wwpn,
                                  'fcplun': self.fcplun, 'e': e}

         try:
             loggedWriteLineToFile(unitremove, self.fcplun)
         except IOError as e:
-            raise ValueError, _("Could not remove LUN %(fcplun)s at WWPN "
-                                "%(wwpn)s on zFCP device %(devnum)s "
-                                "(%(e)s).") \
+            raise ValueError, "Could not remove LUN %(fcplun)s at WWPN " \
+                              "%(wwpn)s on zFCP device %(devnum)s (%(e)s)." \
                               % {'fcplun': self.fcplun, 'wwpn': self.wwpn,
                                  'devnum': self.devnum, 'e': e}

@@ -290,8 +287,8 @@ class ZFCPDevice:
             try:
                 loggedWriteLineToFile(portremove, self.wwpn)
             except IOError as e:
-                raise ValueError, _("Could not remove WWPN %(wwpn)s on zFCP "
-                                    "device %(devnum)s (%(e)s).") \
+                raise ValueError, "Could not remove WWPN %(wwpn)s on zFCP " \
+                                  "device %(devnum)s (%(e)s)." \
                                   % {'wwpn': self.wwpn,
                                      'devnum': self.devnum, 'e': e}

@@ -316,8 +313,8 @@ class ZFCPDevice:
         try:
             loggedWriteLineToFile(offline, "0")
         except IOError as e:
-            raise ValueError, _("Could not set zFCP device %(devnum)s "
-                                "offline (%(e)s).") \
+            raise ValueError, "Could not set zFCP device %(devnum)s " \
+                              "offline (%(e)s)." \
                               % {'devnum': self.devnum, 'e': e}

         return True

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkrdCYsACgkQ5hsjjIy1VkmAsgCgyH+09HipSjispEyJmrT1cHVH
BiQAn3BuD4fyLvUcHdWSJl0YSUdzsewt
=eWhK
-----END PGP SIGNATURE-----
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux