[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Spacewalk-list] Traceback Errors when running 'apt-get update' - debian/ubuntu support



On 11/23/2011 10:55 AM, Simon Lukasik wrote:
Traceback from server is below:
>
The following traceback is not related to the failure above.


It is *probably* not related. But sending traceback is generaly not good behaviour.

Can you please apply these patch and test it for me? It should return 404 for such URLs.
--
Miroslav Suchy
Red Hat Satellite Engineering
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index de3b05c..0fc5bad 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -439,6 +439,9 @@ class rhnFault(Exception):
             return xmlrpclib.Fault(1, s.getvalue())
         return xmlrpclib.Fault(-self.code, s.getvalue())
 
+class rhnNotFound(Exception):
+    """ Raised when we want return 404 Not Found """
+    pass
 
 if __name__ == "__main__":
     print "You can not run this module by itself"
diff --git a/backend/common/rhnRepository.py b/backend/common/rhnRepository.py
index 704590c..02baedd 100644
--- a/backend/common/rhnRepository.py
+++ b/backend/common/rhnRepository.py
@@ -27,7 +27,7 @@ from spacewalk.common import rhn_rpm
 import rhnFlags
 from rhnLog import log_debug
 from rhnLib import rfc822time
-from rhnException import rhnException, rhnFault
+from rhnException import rhnException, rhnFault, rhnNotFound
 from RPC_Base import RPC_Base
 
 class Repository(RPC_Base):
@@ -43,7 +43,8 @@ class Repository(RPC_Base):
         self.functions = [
             'getPackage',
             'getPackageHeader',
-            'getPackageSource'
+            'getPackageSource',
+            'i18n',
         ]
 
     def set_compress_headers(self, val):
@@ -105,6 +106,14 @@ class Repository(RPC_Base):
         
         return self._getFile(filePath)
 
+    def i18n(self, translation, *args):
+        """ Translations files for Ubuntu. E.g. Translation-en_US.bz2
+
+            We do not support it so just return 404. But do not fail with
+            traceback.
+        """
+        raise rhnNotFound()
+
     def getPackageSource(self, pkgFilename):
         """ Get srpm packrge. """
         log_debug(3, pkgFilename)
diff --git a/backend/server/apacheRequest.py b/backend/server/apacheRequest.py
index d396746..7b10e33 100644
--- a/backend/server/apacheRequest.py
+++ b/backend/server/apacheRequest.py
@@ -27,7 +27,7 @@ from spacewalk.common import apache, rhnFlags
 from spacewalk.common.rhnConfig import CFG
 from spacewalk.common import byterange
 from spacewalk.common.rhnLog import log_debug, log_error
-from spacewalk.common.rhnException import rhnFault, \
+from spacewalk.common.rhnException import rhnFault, rhnNotFound,\
         redirectException #to catch redirect exception
 from spacewalk.common.rhnTranslate import _
 from spacewalk.common.rhnLib import setHeaderValue
@@ -136,7 +136,8 @@ class apacheRequest:
                 extra="Response sent back to the caller:\n%s\n" % (
                     response.faultString,),
                 severity="notification")
-            
+        except rhnNotFound, e:
+            return apache.HTTP_NOT_FOUND 
         #pkilambi:catch exception if redirect
         except redirectException, re:
             log_debug(3,"redirect exception caught",re.path)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]