[master 2/4] Fix pylint errors in rescue.py.

dashea installerbot-noreply at redhat.com
Mon Jul 20 21:18:18 UTC 2015


From: David Shea <dshea at redhat.com>

Redefine open to iutil's better open, fix the passing of format
parameters to a translated string, use iutil.setenv to add environment
variables for future child processes instead of modifying the current
process's environment, and ignore the warning about catching Exception.
---
 pyanaconda/rescue.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py
index 108be51..9411ed5 100644
--- a/pyanaconda/rescue.py
+++ b/pyanaconda/rescue.py
@@ -34,6 +34,8 @@
 
 from pykickstart.constants import KS_REBOOT, KS_SHUTDOWN
 
+from pyanaconda.iutil import open   # pylint: disable=redefined-builtin
+
 import os
 import shutil
 import time
@@ -341,8 +343,8 @@ def refresh(self, args=None):
                 else:
                     text = TextWidget(_("Your system has been mounted under %s.\n\nIf "
                                         "you would like to make your system the root "
-                                        "environment, run the command:\n\n\tchroot %s\n"
-                                        % (iutil.getSysroot(), iutil.getSysroot())))
+                                        "environment, run the command:\n\n\tchroot %s\n")
+                                        % (iutil.getSysroot(), iutil.getSysroot()))
                     self._window.append(text)
                 rootmounted = True
 
@@ -366,7 +368,7 @@ def refresh(self, args=None):
                 # set a libpath to use mounted fs
                 libdirs = os.environ.get("LD_LIBRARY_PATH", "").split(":")
                 mounted = list(map(lambda dir: "/mnt/sysimage%s" % dir, libdirs))
-                os.environ["LD_LIBRARY_PATH"] = ":".join(libdirs + mounted)
+                iutil.setenv("LD_LIBRARY_PATH", ":".join(libdirs + mounted))
 
                 # do we have bash?
                 try:
@@ -376,7 +378,7 @@ def refresh(self, args=None):
                     pass
             except (ValueError, LookupError, SyntaxError, NameError):
                 pass
-            except Exception as e:
+            except Exception as e: # pylint: disable=broad-except
                 if flags.automatedInstall:
                     msg = _("Run %s to unmount the system when you are finished.\n") % ANACONDA_CLEANUP
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/96333e14908bd47f5c2ae61429731d597b3fb87f


More information about the anaconda-patches mailing list