Merge pull request #38503 from jinm/issue_38472_jinm

Hash type fallback for file management
This commit is contained in:
Mike Place 2017-01-01 10:36:50 -07:00 committed by GitHub
commit 86f0aa0bb3

View file

@ -4468,12 +4468,12 @@ def manage_file(name,
# Only test the checksums on files with managed contents
if source and not (not follow_symlinks and os.path.islink(real_name)):
name_sum = get_hash(real_name, source_sum['hash_type'])
name_sum = get_hash(real_name, source_sum.get('hash_type', __opts__.get('hash_type', 'md5')))
else:
name_sum = None
# Check if file needs to be replaced
if source and (name_sum is None or source_sum['hsum'] != name_sum):
if source and (name_sum is None or source_sum.get('hsum', __opts__.get('hash_type', 'md5')) != name_sum):
if not sfn:
sfn = __salt__['cp.cache_file'](source, saltenv)
if not sfn: