Skip to content

Commit

Permalink
fix: gen3_s3_info check for existing bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
m0nhawk authored Sep 13, 2024
1 parent 0e02d83 commit cfebaae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gen3/bin/s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,13 @@ 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

gen3_aws_run aws s3api head-bucket --bucket $1 > /dev/null 2>&1
if [[ $? -ne 0 ]]; then
gen3_log_err "Bucket 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 cfebaae

Please sign in to comment.