Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
fix: Use bucket region if available while mounting BYOB studies (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
jn1119 authored Sep 2, 2021
1 parent 9731ba1 commit baf724f
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,26 @@ do
printf 'Mounting internal study "%s" at "%s"\n' "$study_id" "$study_dir"
goofys --region $region --acl "bucket-owner-full-control" "${s3_bucket}:${s3_prefix}" "$study_dir"
else
bucket_region="$(printf "%s" "$mounts" | jq -r ".[$study_idx].region" -)"
# BYOB studies have a region specified, but in case it isn't use the default region
if [[ $bucket_region == "null" ]]; then
printf 'Bucket region is not specified. Defaulting to "%s" for mounting \n' "$region"
bucket_region=$region
fi;

# make .aws dir if it doesn't already exist and add credentials
mkdir -p $AWS_CONFIG_DIR
append_role_to_credentials $study_id $s3_role_arn
if [ "$kms_arn" == "null" ]
then
printf 'Mounting external study "%s" at "%s" using role "%s" \n' "$study_id" "$study_dir" \
"$s3_role_arn"
goofys --region $region --profile $study_id --acl "bucket-owner-full-control" \
printf 'Mounting external study "%s" at "%s" using role "%s" and region "%s" \n' "$study_id" "$study_dir" \
"$s3_role_arn" "$bucket_region"
goofys --region $bucket_region --profile $study_id --acl "bucket-owner-full-control" \
"${s3_bucket}:${s3_prefix}" "$study_dir"
else
printf 'Mounting external study "%s" at "%s" using role "%s" and kms arn "%s" \n' "$study_id" "$study_dir" \
"$s3_role_arn" "$kms_arn"
goofys --region $region --profile $study_id --sse-kms $kms_arn --acl "bucket-owner-full-control" \
printf 'Mounting external study "%s" at "%s" using role "%s", kms arn "%s" and region "%s" \n' "$study_id" "$study_dir" \
"$s3_role_arn" "$kms_arn" "$bucket_region"
goofys --region $bucket_region --profile $study_id --sse-kms $kms_arn --acl "bucket-owner-full-control" \
"${s3_bucket}:${s3_prefix}" "$study_dir"
fi
fi
Expand Down

0 comments on commit baf724f

Please sign in to comment.