Hi,

Am Dienstag, 17. Januar 2012, 10:54:45 schrieb Jan Pazdziora:
> On Mon, Jan 16, 2012 at 04:48:17PM +0100, Michael Calmer wrote:
> > > >  
[...] 
> Renamed in Spacewalk master and rhn-client-tools-1.7.5-1. Thanks for
> pointing this issue out.

Thanks. I have a new patch attached which define YumBaseError and RepoError 
also in SUSE.

-- 
Regards

        Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575  - e-mail: michael.cal...@suse.com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer
HRB 16746 (AG Nürnberg)
From 503627cdd9da6057c32658253c6f2c58451545ac Mon Sep 17 00:00:00 2001
From: Michael Calmer <m...@suse.de>
Date: Thu, 1 Dec 2011 16:58:02 +0100
Subject: [PATCH] implement YumBaseError and RepoError on ImportError if yum cannot be loaded

---
 .../src/up2date_client/up2dateErrors.py            |   33 +++++++++++--------
 1 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py b/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py
index 42a1ddb..0a0993b 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py
@@ -14,18 +14,18 @@ _ = t.ugettext
 import OpenSSL
 import config
 from pkgplatform import getPlatform
+from platform import dist
 
-if getPlatform() == 'deb':
-    RepoError = Error
+if getPlatform() == 'deb' or dist()[0] == 'SuSE':
     class YumBaseError(Exception):
         def __init__(self, errmsg):
             self.value = errmsg
-        def __getattribute__(self, name):
+        def __getattr__(self, name):
             raise AttributeError(_("class %s has no attribute '%s'") % (self.__class__.__name__, name))
         def __setattr__(self, name, value):
             raise AttributeError(_("class %s has no attribute '%s'") % (self.__class__.__name__, name))
 else:
-    from yum.Errors import RepoError, YumBaseError
+    from yum.Errors import YumBaseError
 
 class Error(YumBaseError):
     """base class for errors"""
@@ -65,7 +65,12 @@ class Error(YumBaseError):
                 YumBaseError.__setattr__(self, name, value)
             else:
                 self.__dict__[name] = value
-    
+
+if getPlatform() == 'deb' or dist()[0] == 'SuSE':
+    RepoError = Error
+else:
+    from yum.Errors import RepoError
+
 class RpmError(Error):
     """rpm itself raised an error condition"""
     premsg = _("RPM error.  The message was:\n")
-- 
1.7.3.4

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to