Don't mark files that already were deleted as errors

Also use six.iteritems()
This commit is contained in:
Erik Johnson 2017-04-05 21:23:15 -05:00
parent 51d88a16c8
commit 0918311330

View file

@ -14,6 +14,7 @@ from __future__ import absolute_import
# Import python libs
import copy
import errno
import logging
import os
import re
@ -1614,10 +1615,12 @@ def latest(name,
try:
salt.utils.rm_rf(target_path)
except OSError as exc:
removal_errors[target_path] = exc
if exc.errno != errno.ENOENT:
removal_errors[target_path] = exc
if removal_errors:
err_strings = [
' {0}\n {1}'.format(k, v) for k, v in removal_errors.items()
' {0}\n {1}'.format(k, v)
for k, v in six.iteritems(removal_errors)
]
return _fail(
ret,