Skip to content

Commit

Permalink
Write user credentials 2 a file & pass the path 2 file 2 download tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
VJalili committed Aug 2, 2018
1 parent 880d0bc commit 2446386
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/galaxy/managers/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
Manager and serializer for cloud-based storages.
"""

import json
import logging
import os
import random
import string
from galaxy import model
from galaxy import util
from galaxy.exceptions import (
Expand Down Expand Up @@ -288,10 +292,16 @@ def download(self, trans, history_id, provider, bucket, credentials, dataset_ids
if hda.deleted or hda.purged or hda.state != "ok":
continue
if dataset_ids is None or hda.dataset.id in dataset_ids:
args_file = os.path.abspath(os.path.join(
trans.app.config.new_file_path,
"cd_" + ''.join(random.SystemRandom().choice(
string.ascii_uppercase + string.digits) for _ in range(11))))
with open(args_file, "w") as f:
f.write(json.dumps(credentials))
object_label = hda.name
args = {
"provider": provider,
"credentials": credentials,
"credentials": args_file,
"bucket": bucket,
"object_label": object_label,
"filename": hda.dataset.get_file_name(),
Expand Down

0 comments on commit 2446386

Please sign in to comment.