[Spacewalk-list] Debian registration error - NameError: name 'Error' is not defined

Miroslav Suchý msuchy at redhat.com
Thu Jan 26 15:30:05 UTC 2012


On 01/25/2012 06:49 PM, Jan Šoc wrote:
>> root at triton:~# rhn_register
>> Traceback (most recent call last):
>> File "/usr/sbin/rhn_register", line 24, in <module>
>> from up2date_client import up2dateAuth
>> File "/usr/share/rhn/up2date_client/up2dateAuth.py", line 4, in <module>
>> import rhnserver
>> File "/usr/share/rhn/up2date_client/rhnserver.py", line 21, in <module>
>> import rpcServer
>> File "/usr/share/rhn/up2date_client/rpcServer.py", line 12, in <module>
>> import clientCaps
>> File "/usr/share/rhn/up2date_client/clientCaps.py", line 10, in <module>
>> from capabilities import parseCap
>> File "/usr/share/rhn/up2date_client/capabilities.py", line 4, in <module>
>> import up2dateErrors
>> File "/usr/share/rhn/up2date_client/up2dateErrors.py", line 19, in
>> <module>
>> RepoError = Error
>> NameError: name 'Error' is not defined

This has been fixed in master using several commits.
You may want to apply this patch to make it work:

--- 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

if getPlatform() == 'deb':
-    RepoError = Error
      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':
+    RepoError = Error
+else:
+    from yum.Errors import RepoError
+
  class RpmError(Error):
      """rpm itself raised an error condition"""
      premsg = _("RPM error.  The message was:\n")



Once I get internet in my new house (where I have Debian system) I may 
build new package. Or I may poke Simon. Simon, can you rebuild the package?

-- 
Miroslav Suchy
Red Hat Satellite Engineering




More information about the Spacewalk-list mailing list