Merge pull request #40733 from rallytime/fix-40435

Change file data to bytes before attempting to hash
This commit is contained in:
Mike Place 2017-04-18 14:07:42 -06:00 committed by GitHub
commit f4c9da2da0

View file

@ -5,11 +5,15 @@ This module allows SPM to use the local filesystem to install files for SPM.
.. versionadded:: 2015.8.0
'''
# Import Python libs
from __future__ import absolute_import
import os
import os.path
import logging
# Import Salt libs
import salt.syspaths
import salt.utils
# Get logging started
log = logging.getLogger(__name__)
@ -180,7 +184,7 @@ def hash_file(path, hashobj, conn=None):
return ''
with salt.utils.fopen(path, 'r') as f:
hashobj.update(f.read())
hashobj.update(salt.utils.to_bytes(f.read()))
return hashobj.hexdigest()