object-updater: Ignore ENOENT when trying to unlink stale pending files

Change-Id: Iaac1fb891d70707af38c567d9cca5913b8355b7d
Closes-Bug: #1877924
This commit is contained in:
Tim Burke
2020-05-11 00:09:49 -07:00
parent d050ef82f7
commit f57d4cfa71

View File

@@ -14,6 +14,7 @@
# limitations under the License.
import six.moves.cPickle as pickle
import errno
import os
import signal
import sys
@@ -271,7 +272,11 @@ class ObjectUpdater(Daemon):
if obj_hash == last_obj_hash:
self.stats.unlinks += 1
self.logger.increment('unlinks')
os.unlink(update_path)
try:
os.unlink(update_path)
except OSError as e:
if e.errno != errno.ENOENT:
raise
else:
last_obj_hash = obj_hash
yield {'device': device, 'policy': policy,