Skip to content

Commit

Permalink
Improve logging when keeping the cached source file
Browse files Browse the repository at this point in the history
  • Loading branch information
terminalmage committed Sep 21, 2017
1 parent 4d7bcff commit 8b237c1
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions salt/states/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -1501,12 +1501,15 @@ def extracted(name,
for item in enforce_failed:
ret['comment'] += '\n- {0}'.format(item)

if not keep_source and not source_is_local:
log.debug('Cleaning cached source file %s', cached)
result = __states__['file.not_cached'](source_match, saltenv=__env__)
if not result['result']:
# Don't let failure to delete cached file cause the state itself ot
# fail, just drop it in the warnings.
ret.setdefault('warnings', []).append(result['comment'])
if not source_is_local:
if keep_source:
log.debug('Keeping cached source file %s', cached)
else:
log.debug('Cleaning cached source file %s', cached)
result = __states__['file.not_cached'](source_match, saltenv=__env__)
if not result['result']:
# Don't let failure to delete cached file cause the state
# itself to fail, just drop it in the warnings.
ret.setdefault('warnings', []).append(result['comment'])

return ret

0 comments on commit 8b237c1

Please sign in to comment.