diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2020-09-17 11:36:28 +1200 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2020-09-17 11:36:28 +1200 |
commit | f31ac7463a5ee93d139eecd62c41132bbd0ce520 (patch) | |
tree | f9813b8c274661c957ebb6e1f0647e129152c2a5 | |
parent | 695a63e228548349cfc8d7ced75ecc53e1b1f984 (diff) | |
download | trove-f31ac7463a5ee93d139eecd62c41132bbd0ce520.tar.gz |
[Backup] Ignore 404 error when deleting swift objects
Change-Id: I451551b7cb4e812d81b1341c5b82da3abf7b8d86
-rw-r--r-- | trove/common/strategies/storage/swift.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/trove/common/strategies/storage/swift.py b/trove/common/strategies/storage/swift.py index f2f78523..2d7f0fa6 100644 --- a/trove/common/strategies/storage/swift.py +++ b/trove/common/strategies/storage/swift.py @@ -19,6 +19,7 @@ import json from oslo_log import log as logging import six +import swiftclient from trove.common import cfg from trove.common.clients import create_swift_client @@ -207,8 +208,12 @@ class SwiftStorage(base.Storage): # Delete the old segment file that was copied LOG.debug('Deleting the old segment file %s.', stream_reader.first_segment) - self.connection.delete_object(BACKUP_CONTAINER, - stream_reader.first_segment) + try: + self.connection.delete_object(BACKUP_CONTAINER, + stream_reader.first_segment) + except swiftclient.exceptions.ClientException as e: + if e.http_status != 404: + raise final_swift_checksum = segment_result['etag'] # Validate the object by comparing checksums |