Skip to content

Commit

Permalink
master merge
Browse files Browse the repository at this point in the history
  • Loading branch information
paulineribeyre committed Sep 16, 2024
2 parents 2fe48e3 + 03f987f commit 7906263
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gen3/bin/s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ _add_bucket_to_cloudtrail() {
#
_bucket_exists() {
local bucketName=$1
if [[ -z "$(gen3_aws_run aws s3api head-bucket --bucket $bucketName 2>&1)" ]]; then
gen3_aws_run aws s3api head-bucket --bucket $bucketName > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
echo 0
else
echo 1
Expand Down Expand Up @@ -173,10 +174,12 @@ gen3_s3_info() {
gen3_log_err "Unable to fetch AWS account ID."
return 1
fi
if [[ ! -z "$(gen3_aws_run aws s3api head-bucket --bucket $1 2>&1)" ]]; then

if [[ $(_bucket_exists $bucketName) -ne 0 ]]; then
gen3_log_err "Bucket '$1' does not exist"
return 1
fi

local rootPolicyArn="arn:aws:iam::${AWS_ACCOUNT_ID}:policy"
if gen3_aws_run aws iam get-policy --policy-arn ${rootPolicyArn}/${writerName} >/dev/null 2>&1; then
writerPolicy="{ \"name\": \"$writerName\", \"policy_arn\": \"${rootPolicyArn}/${writerName}\" } "
Expand Down

0 comments on commit 7906263

Please sign in to comment.