diff --git a/percona-xtradb-cluster-5.7-backup/lib/pxc/aws.sh b/percona-xtradb-cluster-5.7-backup/lib/pxc/aws.sh index c29995c73..d809ee28d 100755 --- a/percona-xtradb-cluster-5.7-backup/lib/pxc/aws.sh +++ b/percona-xtradb-cluster-5.7-backup/lib/pxc/aws.sh @@ -15,7 +15,10 @@ is_object_exist() { local path="$2" # '--summarize' is included to retrieve the 'Total Objects:' count for checking object/folder existence - res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive) + res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive 2>&1) + if echo "$res" | grep -q '(NoSuchKey)'; then + return 0 + fi if echo "$res" | grep -q 'Total Objects: 0'; then return 0 # object/folder does not exist fi diff --git a/percona-xtradb-cluster-8.0-backup/lib/pxc/aws.sh b/percona-xtradb-cluster-8.0-backup/lib/pxc/aws.sh index bc613a480..d8f8086d2 100755 --- a/percona-xtradb-cluster-8.0-backup/lib/pxc/aws.sh +++ b/percona-xtradb-cluster-8.0-backup/lib/pxc/aws.sh @@ -15,7 +15,10 @@ is_object_exist() { local path="$2" # '--summarize' is included to retrieve the 'Total Objects:' count for checking object/folder existence - res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive) + res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive 2>&1) + if echo "$res" | grep -q '(NoSuchKey)'; then + return 1 + fi if echo "$res" | grep -q 'Total Objects: 0'; then return 1 # object/folder does not exist fi diff --git a/percona-xtradb-cluster-8.4-backup/lib/pxc/aws.sh b/percona-xtradb-cluster-8.4-backup/lib/pxc/aws.sh index bc613a480..fb418fa29 100755 --- a/percona-xtradb-cluster-8.4-backup/lib/pxc/aws.sh +++ b/percona-xtradb-cluster-8.4-backup/lib/pxc/aws.sh @@ -15,7 +15,10 @@ is_object_exist() { local path="$2" # '--summarize' is included to retrieve the 'Total Objects:' count for checking object/folder existence - res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive) + res=$(aws $AWS_S3_NO_VERIFY_SSL s3 ls "s3://$bucket/$path" --summarize --recursive 2>&1) + if echo "$res" | grep -q '(NoSuchKey)'; then + return 1 + fi if echo "$res" | grep -q 'Total Objects: 0'; then return 1 # object/folder does not exist fi