Skip to content

Commit

Permalink
try to auth so we can gsutilc cp
Browse files Browse the repository at this point in the history
  • Loading branch information
nikellepetrillo committed Dec 13, 2024
1 parent a102049 commit 118862d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/firecloud_api/firecloud_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, workspace_namespace, workspace_name, sa_json_b64, user, actio
scopes=scopes
)
self.delegated_creds = sa_credentials.with_subject(user)
self.storage_client = storage.Client(credentials=sa_credentials, project=sa_credentials.project_id)

def build_auth_headers(self, token: str):
if not self.delegated_creds.valid:
Expand Down Expand Up @@ -285,13 +286,13 @@ def gcloud_auth_list(self):
return None

def gsutil_copy(self, source, destination):
client = storage.Client() # Uses GOOGLE_APPLICATION_CREDENTIALS implicitly
#client = storage.Client() # Uses GOOGLE_APPLICATION_CREDENTIALS implicitly
source_bucket_name, source_blob_name = source.replace("gs://", "").split("/", 1)
destination_bucket_name, destination_blob_name = destination.replace("gs://", "").split("/", 1)

source_bucket = client.bucket(source_bucket_name)
source_bucket = self.storage_client.bucket(source_bucket_name)
source_blob = source_bucket.blob(source_blob_name)
destination_bucket = client.bucket(destination_bucket_name)
destination_bucket = self.storage_client.bucket(destination_bucket_name)

source_bucket.copy_blob(source_blob, destination_bucket, destination_blob_name)

Expand Down

0 comments on commit 118862d

Please sign in to comment.