Fix get_managed() in file.py module for local files

This fixes the 'Unable to manage file: string indices must be integers, not str'
error message problem.

source_sum must be a dictionary not a string.
This commit is contained in:
Julien Barbot 2015-07-29 12:24:24 +02:00 committed by rallytime
parent 423d528b73
commit 1fd4837beb

View file

@ -2929,9 +2929,11 @@ def get_managed(
return '', {}, 'Source file {0} not found'.format(source)
# if its a local file
elif urlparsed_source.scheme == 'file':
source_sum = get_hash(urlparsed_source.path)
file_sum = get_hash(urlparsed_source.path, form='sha256')
source_sum = {'hsum': file_sum, 'hash_type': 'sha256'}
elif source.startswith('/'):
source_sum = get_hash(source)
file_sum = get_hash(source, form='sha256')
source_sum = {'hsum': file_sum, 'hash_type': 'sha256'}
elif source_hash:
protos = ('salt', 'http', 'https', 'ftp', 'swift', 's3')
if _urlparse(source_hash).scheme in protos: