From a42405aa522cd33292b9817da460e9f29e00a201 Mon Sep 17 00:00:00 2001 From: borenet Date: Fri, 9 Sep 2016 05:37:29 -0700 Subject: [PATCH] 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 --- infra/bots/assets/asset_utils.py | 4 ++-- infra/bots/assets/assets.py | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/infra/bots/assets/asset_utils.py b/infra/bots/assets/asset_utils.py index 8a1404fc56..ae58d4539f 100644 --- a/infra/bots/assets/asset_utils.py +++ b/infra/bots/assets/asset_utils.py @@ -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): diff --git a/infra/bots/assets/assets.py b/infra/bots/assets/assets.py index b398988338..3265a63b9e 100755 --- a/infra/bots/assets/assets.py +++ b/infra/bots/assets/assets.py @@ -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)