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:
borenet 2016-09-09 05:37:29 -07:00 committed by Commit bot
parent e06ca96174
commit a42405aa52
2 changed files with 10 additions and 6 deletions

View File

@ -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):

View File

@ -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)