Index: tools/telemetry/catapult_base/cloud_storage.py |
diff --git a/tools/telemetry/catapult_base/cloud_storage.py b/tools/telemetry/catapult_base/cloud_storage.py |
index 6963da6acf0ce2a1fa7338772f11a0d70aba076c..62faa67445a7d0a45ae4aa39c352507f9faf1c77 100644 |
--- a/tools/telemetry/catapult_base/cloud_storage.py |
+++ b/tools/telemetry/catapult_base/cloud_storage.py |
@@ -203,10 +203,14 @@ def Copy(bucket_from, bucket_to, remote_path_from, remote_path_to): |
_RunCommand(['cp', url1, url2]) |
-def Delete(bucket, remote_path): |
+def Delete(bucket, remote_path, recursive=False): |
erikchen
2015/07/14 23:36:15
If you do a zip upload, you won't need to add this
sydli
2015/07/15 22:56:24
Done.
|
url = 'gs://%s/%s' % (bucket, remote_path) |
+ command_and_args = ['rm'] |
+ if recursive: |
+ command_and_args += ['-r'] |
+ command_and_args += [url] |
logging.info('Deleting %s' % url) |
- _RunCommand(['rm', url]) |
+ _RunCommand(command_and_args) |
def Get(bucket, remote_path, local_path): |
@@ -219,7 +223,8 @@ def Get(bucket, remote_path, local_path): |
_RunCommand(['cp', url, local_path]) |
-def Insert(bucket, remote_path, local_path, publicly_readable=False): |
+def Insert(bucket, remote_path, local_path, recursive=False, |
+ publicly_readable=False): |
""" Upload file in |local_path| to cloud storage. |
Args: |
bucket: the google cloud storage bucket name. |
@@ -234,6 +239,8 @@ def Insert(bucket, remote_path, local_path, publicly_readable=False): |
url = 'gs://%s/%s' % (bucket, remote_path) |
command_and_args = ['cp'] |
extra_info = '' |
+ if recursive: |
+ command_and_args += ['-r'] |
if publicly_readable: |
command_and_args += ['-a', 'public-read'] |
extra_info = ' (publicly readable)' |