file is deleted between each retry helps handle that eventuality.
"""
+from __future__ import print_function
+
import shutil
from chromite.lib import commandline
from chromite.lib import cros_build_lib
from chromite.lib import gs
from chromite.lib import osutils
-from chromite.lib import retry_util
def GetParser():
parser.add_argument('filename', help='Location to store the file.')
return parser
+
def Copy(ctx, uri, filename):
"""Run the copy using a temp file."""
temp_path = '%s.tmp' % filename
osutils.SafeUnlink(temp_path)
try:
- ctx.Copy(uri, temp_path, log_output=True)
+ ctx.Copy(uri, temp_path)
shutil.move(temp_path, filename)
finally:
osutils.SafeUnlink(temp_path)
+
def main(argv):
parser = GetParser()
options = parser.parse_args(argv)
- ctx = gs.GSContext(retries=0)
+ ctx = gs.GSContext()
try:
- retry_util.RetryCommand(Copy, ctx.DEFAULT_RETRIES, ctx, options.uri,
- options.filename, sleep=ctx.DEFAULT_SLEEP_TIME)
- except (gs.GSContextException, cros_build_lib.RunCommandError) as ex:
+ Copy(ctx, options.uri, options.filename)
+ except gs.GSContextException as ex:
# Hide the stack trace using Die.
cros_build_lib.Die('%s', ex)