Skip to content

Commit

Permalink
Improve recursive object restore
Browse files Browse the repository at this point in the history
When restoring a complete bucket stop and raise an error only when
the configuration is set to stop on the first error.
otherwise keep trying to restore the next objects.

closes #1369

Signed-off-by: Alexandre Lavigne <lavigne958@gmail.com>
  • Loading branch information
lavigne958 committed Apr 14, 2024
1 parent dbdee8f commit b56e3ad
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions s3cmd
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,8 @@ def cmd_object_restore(args):
warning(u"Exiting now because of --dry-run")
return EX_OK

ret = EX_OK

for key in remote_list:
item = remote_list[key]

Expand All @@ -934,11 +936,15 @@ def cmd_object_restore(args):
except S3Error as e:
if e.code == "RestoreAlreadyInProgress":
warning("%s: %s" % (e.message, item['object_uri_str']))
else:
elif cfg.stop_on_error:
raise e
else:
error("restore failed for: '%s' (%s)", item['object_uri_str'], e)
ret = EX_PARTIAL

else:
debug(u"Skipping directory since only files may be restored")
return EX_OK
return ret


def subcmd_cp_mv(args, process_fce, action_str, message):
Expand Down

0 comments on commit b56e3ad

Please sign in to comment.