[yum-commits] Branch 'yum-3_2_X' - yum/rpmtrans.py

skvidal at osuosl.org skvidal at osuosl.org
Mon Apr 13 16:29:30 UTC 2009


 yum/rpmtrans.py |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit 43f9c7a1febfd75c8cb68bdf34b3688edbc85a52
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Mon Apr 13 12:27:21 2009 -0400

    add an exception catch for the traceback posted here:
    https://bugzilla.redhat.com/show_bug.cgi?id=494149
    
    It _shouldn't_ happen to begin with but since it CAN happen we might as well catch it
    and give off a real error

diff --git a/yum/rpmtrans.py b/yum/rpmtrans.py
index 1d3b25c..806fd25 100644
--- a/yum/rpmtrans.py
+++ b/yum/rpmtrans.py
@@ -408,13 +408,17 @@ class RPMTransaction:
         if h is not None:
             hdr, rpmloc = h[0], h[1]
             handle = self._makeHandle(hdr)
-            fd = os.open(rpmloc, os.O_RDONLY)
-            self.filehandles[handle]=fd
-            if self.trans_running:
-                self.total_installed += 1
-                self.complete_actions += 1
-                self.installed_pkg_names.append(hdr['name'])
-            return fd
+            try:
+                fd = os.open(rpmloc, os.O_RDONLY)
+            except OSError, e:
+                self.displaylog.errorlog("Error: Cannot open file %s: %s" % (rpmloc, e))
+            else:
+                self.filehandles[handle]=fd
+                if self.trans_running:
+                    self.total_installed += 1
+                    self.complete_actions += 1
+                    self.installed_pkg_names.append(hdr['name'])
+                return fd
         else:
             self.display.errorlog("Error: No Header to INST_OPEN_FILE")
             


More information about the Yum-commits mailing list