From c09667d695a6ddf608aae34c50d185c34c3666fc Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Wed, 23 Nov 2016 09:21:04 -0600 Subject: Client/Proxy.py: Provide more useful error message Previously, having a ca specified in the client bcfg2.conf which pointed to a file that didn't exist resulted in the following: Unknown failure: [Errno 2] No such file or directory (IOError) Unknown failure: [Errno 2] No such file or directory (IOError) Unknown failure: [Errno 2] No such file or directory (IOError) Fatal error: Failed to declare version: Unknown failure: [Errno 2] No such file or directory (IOError) This commit provides more information about the actual cause of the issue. Signed-off-by: Sol Jerome --- src/lib/Bcfg2/Client/Proxy.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/lib') diff --git a/src/lib/Bcfg2/Client/Proxy.py b/src/lib/Bcfg2/Client/Proxy.py index f1caa383a..f383911a3 100644 --- a/src/lib/Bcfg2/Client/Proxy.py +++ b/src/lib/Bcfg2/Client/Proxy.py @@ -1,3 +1,4 @@ +import os.path import re import sys import time @@ -202,6 +203,8 @@ class SSLHTTPConnection(httplib.HTTPConnection): raise Exception("unknown protocol %s" % self.protocol) if self.ca: other_side_required = ssl.CERT_REQUIRED + if not os.path.isfile(self.ca): + self.logger.error("CA specified but none found at %s" % self.ca) else: other_side_required = ssl.CERT_NONE self.logger.warning("No ca is specified. Cannot authenticate the " -- cgit v1.2.3-1-g7c22