mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #40733 from rallytime/fix-40435
Change file data to bytes before attempting to hash
This commit is contained in:
commit
f4c9da2da0
1 changed files with 5 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue