Index: ubuntuone-client-1.0.1/ubuntuone/oauthdesktop/auth.py =================================================================== --- ubuntuone-client-1.0.1.orig/ubuntuone/oauthdesktop/auth.py +++ ubuntuone-client-1.0.1/ubuntuone/oauthdesktop/auth.py @@ -40,6 +40,7 @@ from twisted.web import server, resource from ubuntuone.oauthdesktop.logger import setupLogging logger = setupLogging("UbuntuOne.OAuthDesktop.auth") +CA_CERTS = "/etc/ssl/certs/ca-certificates.crt" class NoAccessToken(Exception): """No access token available.""" @@ -61,7 +62,7 @@ def _connect_wrapper(self): self._tunnel() self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file, cert_reqs=ssl.CERT_REQUIRED, - ca_certs="/etc/ssl/certs/ca-certificates.crt") + ca_certs=CA_CERTS) httplib.HTTPSConnection.connect = _connect_wrapper class FancyURLOpenerWithRedirectedPOST(urllib.FancyURLopener): @@ -218,6 +219,13 @@ class AuthorisationClient(object): def make_token_request(self, oauth_request): """Perform the given `OAuthRequest` and return the associated token.""" + # if the certificate file is not there this will fail with an obtuse + # error message, so check in a friendly way first. + if not os.path.exists(CA_CERTS): + self._forward_error_callback(Exception( + "Certificate file %s does not exist!" % CA_CERTS)) + return + logger.debug("Making a token request") # Note that we monkeypatched httplib above to handle invalid certs # Ways this urlopen can fail: