Merge "Do not suppress all exceptions"

This commit is contained in:
Zuul 2017-10-17 20:18:46 +00:00 committed by Gerrit Code Review
commit 0cc9fdc61d

View File

@ -15,6 +15,7 @@
# limitations under the License.
from datetime import datetime
import errno
import json
import os.path
import pyghmi.constants as pygconst
@ -25,6 +26,7 @@ import pyghmi.ipmi.private.util as util
import pyghmi.ipmi.sdr as sdr
import pyghmi.util.webclient as webclient
import random
import socket
import struct
import threading
import urllib
@ -137,7 +139,9 @@ class IMMClient(object):
wc = webclient.SecureHTTPConnection(self.imm, 443, verifycallback=cv)
try:
wc.connect()
except Exception:
except socket.error as se:
if se.errno != errno.ECONNREFUSED:
raise
return None
adata = urllib.urlencode({'user': self.username,
'password': self.password,
@ -455,7 +459,9 @@ class XCCClient(IMMClient):
wc = webclient.SecureHTTPConnection(self.imm, 443, verifycallback=cv)
try:
wc.connect()
except Exception:
except socket.error as se:
if se.errno != errno.ECONNREFUSED:
raise
return None
adata = json.dumps({'username': self.username,
'password': self.password