Repository: nifi Updated Branches: refs/heads/support/nifi-0.5.x a9b34e188 -> e15a2b32d
NIFI-1542: Update how PutS3Object handles a 403 AccessDenied response to a S3 ListMultipartUploads request. * Change log message from error to warning and added note about S3 permissions. * Advance the ageoff check time by the check interval as if the request succeeded to prevent re-checking on every upload when permission does not exist. Reviewed by Tony Kurc ([email protected]) (with minor amendments for whitespace and error message consistency). Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/e15a2b32 Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/e15a2b32 Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/e15a2b32 Branch: refs/heads/support/nifi-0.5.x Commit: e15a2b32db8da1e46cafbab1703cf04b2dffee95 Parents: a9b34e1 Author: Joe Skora <[email protected]> Authored: Sun Feb 21 16:05:12 2016 -0500 Committer: Tony Kurc <[email protected]> Committed: Sun Feb 21 18:13:37 2016 -0500 ---------------------------------------------------------------------- .../apache/nifi/processors/aws/s3/PutS3Object.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/e15a2b32/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java index 0c033c9..4726ab7 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java @@ -39,6 +39,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import com.amazonaws.services.s3.model.AmazonS3Exception; import org.apache.nifi.annotation.behavior.DynamicProperty; import org.apache.nifi.annotation.behavior.InputRequirement; import org.apache.nifi.annotation.behavior.InputRequirement.Requirement; @@ -695,8 +696,19 @@ public class PutS3Object extends AbstractS3Processor { ageoffLocalState(ageCutoff); lastS3AgeOff.set(System.currentTimeMillis()); } catch(AmazonClientException e) { - getLogger().error("Error checking S3 Multipart Upload list for {}: {}", - new Object[]{bucket, e.getMessage()}); + if (e instanceof AmazonS3Exception + && ((AmazonS3Exception)e).getStatusCode() == 403 + && ((AmazonS3Exception) e).getErrorCode().equals("AccessDenied")) { + getLogger().warn("AccessDenied checking S3 Multipart Upload list for {}: {} " + + "** The configured user does not have the s3:ListBucketMultipartUploads permission " + + "for this bucket, S3 ageoff cannot occur without this permission. Next ageoff check " + + "time is being advanced by interval to prevent checking on every upload **", + new Object[]{bucket, e.getMessage()}); + lastS3AgeOff.set(System.currentTimeMillis()); + } else { + getLogger().error("Error checking S3 Multipart Upload list for {}: {}", + new Object[]{bucket, e.getMessage()}); + } } finally { s3BucketLock.unlock(); }
