client/rhel/rhn-client-tools/rhn-client-tools.spec | 1 client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py | 11 ++++------ 2 files changed, 6 insertions(+), 6 deletions(-)
New commits: commit 3ef12a289c1f1341144caf2af1d2595cd1500a66 Author: Miroslav Suchý msuchy@redhat.com Date: Thu Mar 31 15:30:25 2011 +0200
691188 - inherit SSLCertificateVerifyFailedError from RepoError
yum and GUI tools knows how to handle RepoError and will show nice error instead of ugly Traceback addressing: Traceback (most recent call last): File "/usr/bin/yum", line 29, in <module> yummain.user_main(sys.argv[1:], exit_code=True) File "/usr/share/yum-cli/yummain.py", line 254, in user_main errcode = main(args) File "/usr/share/yum-cli/yummain.py", line 88, in main base.getOptionsConfig(args) File "/usr/share/yum-cli/cli.py", line 192, in getOptionsConfig self.conf File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 778, in <lambda> conf = property(fget=lambda self: self._getConfig(), File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 311, in _getConfig self.plugins.run('init') File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 179, in run func(conduitcls(self, self.base, conf, **kwargs)) File "/usr/share/yum-plugins/rhnplugin.py", line 117, in init_hook login_info = up2dateAuth.getLoginInfo() File "/usr/share/rhn/up2date_client/up2dateAuth.py", line 219, in getLoginInfo login() File "/usr/share/rhn/up2date_client/up2dateAuth.py", line 186, in login li = server.up2date.login(systemId) File "/usr/share/rhn/up2date_client/rhnserver.py", line 64, in __call__ raise up2dateErrors.SSLCertificateVerifyFailedError() SSLCertificateVerifyFailedError: The SSL certificate failed verification.
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec index ba49218..1b92ecc 100644 --- a/client/rhel/rhn-client-tools/rhn-client-tools.spec +++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec @@ -32,6 +32,7 @@ Requires: hal >= 0.5.8.1-52 Requires: newt Requires: python-dmidecode Requires: libxml2-python +Requires: yum
Conflicts: up2date < 5.0.0 Conflicts: yum-rhn-plugin < 1.1.4-1 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 da0f529..0624d33 100644 --- a/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py +++ b/client/rhel/rhn-client-tools/src/up2date_client/up2dateErrors.py @@ -13,6 +13,7 @@ t = gettext.translation('rhn-client-tools', fallback=True) _ = t.ugettext import OpenSSL import config +from yum.Errors import RepoError
class Error: """base class for errors""" @@ -188,9 +189,7 @@ class NoChannelsError(Error): def __repr__(self): return self.errmsg
-class SSLCertificateVerifyFailedError(Error): - # TODO This should be a subclass of OpenSSL.Error or whatever and raised - # from rhnlib. +class SSLCertificateVerifyFailedError(RepoError): def __init__(self): # Need to override __init__ because the base class requires a message arg # and this exception shouldn't. @@ -201,10 +200,10 @@ class SSLCertificateVerifyFailedError(Error): f.close() tempCert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, buf) if tempCert.has_expired(): - Error.__init__(self ,"The certificate is expired. Please ensure you have the correct" - " certificate and your system time is correct.") + RepoError.__init__(self ,"The certificate %s is expired. Please ensure you have the correct" + " certificate and your system time is correct." % certFile) else: - Error.__init__(self, "The SSL certificate failed verification.") + RepoError.__init__(self, "The SSL certificate %s failed verification." % certFile)
class SSLCertificateFileNotFound(Error): def __init__(self, errmsg):
spacewalk-commits@lists.fedorahosted.org