Update bare exceptions to specify Exception.

This will keep us from accidentally catching program-exiting exceptions
like KeyboardInterupt and SystemExit.
This commit is contained in:
Toshio Kuratomi
2018-09-07 17:59:46 -07:00
parent 5147e792d3
commit 3fba006207
320 changed files with 659 additions and 656 deletions

View File

@@ -103,7 +103,7 @@ class Display(with_metaclass(Singleton, object)):
self.cows_available = set([to_text(c) for c in out.split()])
if C.ANSIBLE_COW_WHITELIST:
self.cows_available = set(C.ANSIBLE_COW_WHITELIST).intersection(self.cows_available)
except:
except Exception:
# could not execute cowsay for some reason
self.b_cowsay = False

View File

@@ -25,7 +25,7 @@ try:
from passlib.utils.handlers import HasRawSalt
PASSLIB_AVAILABLE = True
except:
except Exception:
pass
display = Display()
@@ -126,7 +126,7 @@ class PasslibHash(BaseHash):
try:
self.crypt_algo = getattr(passlib.hash, algorithm)
except:
except Exception:
raise AnsibleError("passlib does not support '%s' algorithm" % algorithm)
def hash(self, secret, salt=None, salt_size=None, rounds=None):

View File

@@ -69,7 +69,7 @@ def _validate_mutable_mappings(a, b):
for x in [a, b]:
try:
myvars.append(dumps(x))
except:
except Exception:
myvars.append(to_native(x))
raise AnsibleError("failed to combine variables, expected dicts but got a '{0}' and a '{1}': \n{2}\n{3}".format(
a.__class__.__name__, b.__class__.__name__, myvars[0], myvars[1])