Catch traceback caused by permissions errors during a local md5 sum

Fixes #6948
pull/6907/merge
James Cammarata 11 years ago
parent db36c41c3b
commit 2cc4ac2e75

@ -590,12 +590,15 @@ def md5(filename):
return None
digest = _md5()
blocksize = 64 * 1024
try:
infile = open(filename, 'rb')
block = infile.read(blocksize)
while block:
digest.update(block)
block = infile.read(blocksize)
infile.close()
except IOError, e:
raise errors.AnsibleError("error while accessing the file %s, error was: %s" % (filename, e))
return digest.hexdigest()
def default(value, function):

Loading…
Cancel
Save