Rework RunCurl.

This simplifies RunCurl implementation.
- Remove fail option. This can be a part of args.
- Do not overwrite capture_output. Let caller set it.
- Flatten several nested statements.

This is preparation to make GenericRetry a decorator,
to migrate with autotest's.

BUG=chromium:713539
TEST=Ran bots.

Change-Id: I65740bdb9ffa94d0764ed9e06cdf916ffd8bb3d3
Reviewed-on: https://chromium-review.googlesource.com/491228
Commit-Ready: Hidehiko Abe <hidehiko@chromium.org>
Tested-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index 0d8eb80..7558d19 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -134,8 +134,8 @@
     content_length = 0
     logging.debug('Attempting download from %s', url)
     result = retry_util.RunCurl(
-        ['-I', url], fail=False, capture_output=False, redirect_stdout=True,
-        redirect_stderr=True, print_cmd=False, debug_level=logging.NOTICE)
+        ['-I', url], print_cmd=False, debug_level=logging.NOTICE,
+        capture_output=True)
     successful = False
     for header in result.output.splitlines():
       # We must walk the output to find the 200 code for use cases where
@@ -163,8 +163,8 @@
 
   if current_size < content_length:
     retry_util.RunCurl(
-        ['-L', '-y', '30', '-C', '-', '--output', tarball_dest, url],
-        print_cmd=False, capture_output=False, debug_level=logging.NOTICE)
+        ['--fail', '-L', '-y', '30', '-C', '-', '--output', tarball_dest, url],
+        print_cmd=False, debug_level=logging.NOTICE)
 
   # Cleanup old tarballs now since we've successfull fetched; only cleanup
   # the tarballs for our prefix, or unknown ones. This gets a bit tricky