quote source file name in file mod error messages

This commit is contained in:
Justin Findlay 2015-05-02 14:17:55 -06:00
parent f58f3dac1d
commit db0f85a882

View file

@ -3120,7 +3120,7 @@ def get_managed(
# exists doesn't play nice with sfn as bool
# but if cache failed, sfn == False
if not sfn or not os.path.exists(sfn):
return sfn, {}, 'Source file {0} not found'.format(source)
return sfn, {}, 'Source file {0!r} not found'.format(source)
if sfn == name:
raise SaltInvocationError(
'Source file cannot be the same as destination'
@ -3161,7 +3161,7 @@ def get_managed(
if _urlparse(source).scheme == 'salt':
source_sum = __salt__['cp.hash_file'](source, saltenv)
if not source_sum:
return '', {}, 'Source file {0} not found'.format(source)
return '', {}, 'Source file {0!r} not found'.format(source)
elif source_hash:
protos = ['salt', 'http', 'https', 'ftp', 'swift', 's3']
if _urlparse(source_hash).scheme in protos:
@ -3723,7 +3723,7 @@ def manage_file(name,
sfn = __salt__['cp.cache_file'](source, saltenv)
if not sfn:
return _error(
ret, 'Source file {0} not found'.format(source))
ret, 'Source file {0!r} not found'.format(source))
# If the downloaded file came from a non salt server source verify
# that it matches the intended sum value
if _urlparse(source).scheme != 'salt':
@ -3814,7 +3814,7 @@ def manage_file(name,
sfn = __salt__['cp.cache_file'](source, saltenv)
if not sfn:
return _error(
ret, 'Source file {0} not found'.format(source))
ret, 'Source file {0!r} not found'.format(source))
# If the downloaded file came from a non salt server source verify
# that it matches the intended sum value
if _urlparse(source).scheme != 'salt':
@ -3883,7 +3883,7 @@ def manage_file(name,
sfn = __salt__['cp.cache_file'](source, saltenv)
if not sfn:
return _error(
ret, 'Source file {0} not found'.format(source))
ret, 'Source file {0!r} not found'.format(source))
# If the downloaded file came from a non salt server source verify
# that it matches the intended sum value
if _urlparse(source).scheme != 'salt':