Catch MinionError in file.source_list

Resolves #38825.
This commit is contained in:
Erik Johnson 2017-01-20 15:23:04 -06:00
parent ac8008d843
commit e40fac589a

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.warning(exc.strerror)
elif proto == 'file' and os.path.exists(urlparsed_single_src.path):
ret = (single_src, single_hash)
break