pylint: remove bare except

Bare except should not be used.

Reviewed-By: Petr Spacek <pspacek@redhat.com>
Reviewed-By: Lukas Slebodnik <lslebodn@redhat.com>
This commit is contained in:
Martin Basti
2016-03-22 10:20:51 +01:00
parent aa74995736
commit 491447cc5a
25 changed files with 51 additions and 57 deletions
+4 -4
View File
@@ -160,19 +160,19 @@ def __parse_config(discover_server = True):
try:
if not config.default_realm:
config.default_realm = p.get("global", "realm")
except:
except AttributeError:
pass
if discover_server:
try:
s = p.get("global", "xmlrpc_uri")
server = urlsplit(s)
config.default_server.append(server.netloc)
except:
except Exception:
pass
try:
if not config.default_domain:
config.default_domain = p.get("global", "domain")
except:
except AttributeError:
pass
def __discover_config(discover_server = True):
@@ -218,7 +218,7 @@ def __discover_config(discover_server = True):
hostname = str(server.target).rstrip(".")
config.default_server.append(hostname)
except:
except Exception:
pass
def add_standard_options(parser):
+2 -2
View File
@@ -505,7 +505,7 @@ def file_exists(filename):
return True
else:
return False
except:
except Exception:
return False
def dir_exists(filename):
@@ -515,7 +515,7 @@ def dir_exists(filename):
return True
else:
return False
except:
except Exception:
return False
def install_file(fname, dest):
+1 -1
View File
@@ -606,7 +606,7 @@ def parse_log_level(level):
if isinstance(level, six.string_types):
try:
level = int(level)
except:
except ValueError:
pass
# If it's a string lookup it's name and map to logging level
+6 -11
View File
@@ -223,17 +223,12 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
self.tls_version_max = str(tls_version_max)
def _create_socket(self):
# TODO: remove the try block once python-nss is guaranteed to contain
# these values
try:
#pylint: disable=E1101
ssl_enable_renegotiation = ssl.SSL_ENABLE_RENEGOTIATION
ssl_require_safe_negotiation = ssl.SSL_REQUIRE_SAFE_NEGOTIATION
ssl_renegotiate_requires_xtn = ssl.SSL_RENEGOTIATE_REQUIRES_XTN
except:
ssl_enable_renegotiation = 20
ssl_require_safe_negotiation = 21
ssl_renegotiate_requires_xtn = 2
ssl_enable_renegotiation = getattr(
ssl, 'SSL_ENABLE_RENEGOTIATION', 20)
ssl_require_safe_negotiation = getattr(
ssl,'SSL_REQUIRE_SAFE_NEGOTIATION', 21)
ssl_renegotiate_requires_xtn = getattr(
ssl, 'SSL_RENEGOTIATE_REQUIRES_XTN', 2)
# Create the socket here so we can do things like let the caller
# override the NSS callbacks