Merge pull request #38847 from terminalmage/issue38825

Catch MinionError in file.source_list
This commit is contained in:
Mike Place 2017-01-24 09:03:09 -07:00 committed by GitHub
commit 405d86a2ca

View file

@ -55,7 +55,7 @@ import salt.utils.files
import salt.utils.locales
import salt.utils.templates
import salt.utils.url
from salt.exceptions import CommandExecutionError, SaltInvocationError, get_error_message as _get_error_message
from salt.exceptions import CommandExecutionError, MinionError, SaltInvocationError, get_error_message as _get_error_message
log = logging.getLogger(__name__)
@ -3395,9 +3395,14 @@ def source_list(source, source_hash, saltenv):
ret = (single_src, single_hash)
break
elif proto.startswith('http') or proto == 'ftp':
if __salt__['cp.cache_file'](single_src):
ret = (single_src, single_hash)
break
try:
if __salt__['cp.cache_file'](single_src):
ret = (single_src, single_hash)
break
except MinionError as exc:
# Error downloading file. Log the caught exception and
# continue on to the next source.
log.exception(exc)
elif proto == 'file' and os.path.exists(urlparsed_single_src.path):
ret = (single_src, single_hash)
break