Fix issue with downloading the node_modules.
The //scripts/fetch_node_modules.py issue called out to
`gsutil.py cp`, but I hadn't implemented the equivalent
of the `--no-auth` flag that `download_from_google_storage`
uses when fetching world-readable assets.
This CL switches to just fetch the file over HTTPS to avoid
the issue completely (and also speeds things up).
Bug: 1278563
Change-Id: I1ec50c8b41965b794b2c991b703ab26985003c81
Reviewed-on: https://chromium-review.googlesource.com/c/website/+/3327795
Reviewed-by: Gary Tong <gatong@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
diff --git a/scripts/fetch_node_modules.py b/scripts/fetch_node_modules.py
index 0aef2fa..c8b4d34 100755
--- a/scripts/fetch_node_modules.py
+++ b/scripts/fetch_node_modules.py
@@ -29,9 +29,9 @@
import argparse
import hashlib
import os
-import subprocess
import sys
import tarfile
+from urllib.request import urlopen
SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
@@ -55,14 +55,10 @@
if actual_sha1 == expected_sha1:
return 0
- retcode = subprocess.call([
- 'gsutil.py',
- 'cp',
- 'gs://chromium-website-lob-storage/%s' % expected_sha1,
- tgz
- ])
- if retcode:
- return retcode
+ url = 'https://storage.googleapis.com/%s/%s' % (
+ 'chromium-website-lob-storage', expected_sha1)
+ with urlopen(url) as url_fp, open(tgz, 'wb') as tgz_fp:
+ tgz_fp.write(url_fp.read())
try:
# TODO(dpranke): download_from_google_storage puts in a fair amount