Fix issues in assets scripts
- Delete unconditionally uses 'gsutil' - args.gsutil not plumbed properly BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2326663002 Review-Url: https://codereview.chromium.org/2326663002
This commit is contained in:
parent
e06ca96174
commit
a42405aa52
@ -198,11 +198,11 @@ class GSStore(object):
|
||||
gs_path = GS_SUBDIR_TMPL % (self._gs_bucket, name)
|
||||
attempt_delete = True
|
||||
try:
|
||||
subprocess.check_call(['gsutil', 'ls', gs_path])
|
||||
subprocess.check_call(self._gsutil + ['ls', gs_path])
|
||||
except subprocess.CalledProcessError:
|
||||
attempt_delete = False
|
||||
if attempt_delete:
|
||||
subprocess.check_call(['gsutil', 'rm', '-rf', gs_path])
|
||||
subprocess.check_call(self._gsutil + ['rm', '-rf', gs_path])
|
||||
|
||||
|
||||
class MultiStore(object):
|
||||
|
@ -25,23 +25,27 @@ import utils
|
||||
|
||||
def add(args):
|
||||
"""Add a new asset."""
|
||||
asset_utils.Asset.add(args.asset_name, asset_utils.MultiStore())
|
||||
asset_utils.Asset.add(args.asset_name,
|
||||
asset_utils.MultiStore(gsutil=args.gsutil))
|
||||
|
||||
|
||||
def remove(args):
|
||||
"""Remove an asset."""
|
||||
asset_utils.Asset(args.asset_name, asset_utils.MultiStore()).remove()
|
||||
asset_utils.Asset(args.asset_name,
|
||||
asset_utils.MultiStore(gsutil=args.gsutil)).remove()
|
||||
|
||||
|
||||
def download(args):
|
||||
"""Download the current version of an asset."""
|
||||
asset = asset_utils.Asset(args.asset_name, asset_utils.MultiStore())
|
||||
asset = asset_utils.Asset(args.asset_name,
|
||||
asset_utils.MultiStore(gsutil=args.gsutil))
|
||||
asset.download_current_version(args.target_dir)
|
||||
|
||||
|
||||
def upload(args):
|
||||
"""Upload a new version of the asset."""
|
||||
asset = asset_utils.Asset(args.asset_name, asset_utils.MultiStore())
|
||||
asset = asset_utils.Asset(args.asset_name,
|
||||
asset_utils.MultiStore(gsutil=args.gsutil))
|
||||
asset.upload_new_version(args.target_dir, commit=args.commit)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user