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

Jeremy Katz katzj at osuosl.org
Wed May 13 19:54:37 UTC 2009


 yum/repoMDObject.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

New commits:
commit 9ecde0affdf5a75a88866260db4a0cb3c0d4bf87
Author: Jeremy Katz <katzj at redhat.com>
Date:   Wed May 13 14:10:30 2009 -0400

    Catch error opening repo files
    
    Rather than requiring higher level callers to catch the error,
    we should catch the error at the low-level when opening the
    repo file and turn it into a RepoMDError.  Related to
    rh bz#500526

diff --git a/yum/repoMDObject.py b/yum/repoMDObject.py
index 298d369..37f10f0 100755
--- a/yum/repoMDObject.py
+++ b/yum/repoMDObject.py
@@ -81,7 +81,10 @@ class RepoMD:
         
         if type(srcfile) in types.StringTypes:
             # srcfile is a filename string
-            infile = open(srcfile, 'rt')
+            try:
+                infile = open(srcfile, 'rt')
+            except IOError:
+                raise RepoMDError, "Unable to open %s" %(srcfile,)
         else:
             # srcfile is a file object
             infile = srcfile


More information about the Yum-commits mailing list