gs_fetch_binpkg: add a --boto command line option
Currently our make.conf files are passing the boto settings to
gs_fetch_binpkg by running bash to set the $BOTO_CONFIG env var.
Since our lib.gs already accepts custom boto files, we can add a
command line option to the tool to pass that down. No more need
for indirection.
BUG=None
TEST=`gs_fetch_binpkg --boto $PWD/googlestorage_account.boto gs://chromeos-localmirror/distfiles/rmi4utils-1.1.0.tar.gz foo` works and uses custom boto
Change-Id: I5a07eb1eedeb45d8992b382c365f19c711186cdc
Reviewed-on: https://chromium-review.googlesource.com/271210
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Trybot-Ready: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/gs_fetch_binpkg.py b/scripts/gs_fetch_binpkg.py
index 50a362d..a6c02be 100644
--- a/scripts/gs_fetch_binpkg.py
+++ b/scripts/gs_fetch_binpkg.py
@@ -26,6 +26,7 @@
def GetParser():
"""Creates the argparse parser."""
parser = commandline.ArgumentParser(description=__doc__)
+ parser.add_argument('--boto', type='path', help='Path to boto auth file.')
parser.add_argument('uri', help='Google Storage URI to download')
parser.add_argument('filename', help='Location to store the file.')
return parser
@@ -45,7 +46,8 @@
def main(argv):
parser = GetParser()
options = parser.parse_args(argv)
- ctx = gs.GSContext()
+ options.Freeze()
+ ctx = gs.GSContext(boto_file=options.boto)
try:
Copy(ctx, options.uri, options.filename)
except gs.GSContextException as ex: