Skip to content
Browse files

Merge pull request #21 from aral/s3-static-site-cloudfront-invalidation

Added S3 static site support for Amazon CloudFront invalidation on sync.
  • Loading branch information...
2 parents add5f2b + 6eacb08 commit 23d133a2f715dc684b31604ce2d4525ebd50213c @mludvig mludvig committed Feb 22, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 S3/
10 S3/
@@ -555,8 +555,16 @@ def get_dist_name_for_bucket(self, uri):
for d in response['dist_list'].dist_summs:
CloudFront.dist_list[getBucketFromHostname(['S3Origin']['DNSName'])[0]] = d.uri()
+ elif"CustomOrigin"):
+ # Aral: This used to skip over distributions with CustomOrigin, however, we mustn't
+ # do this since S3 buckets that are set up as websites use custom origins.
+ # Thankfully, the custom origin URLs they use start with the URL of the
+ # S3 bucket. Here, we make use this naming convention to support this use case.
+ distListIndex = getBucketFromHostname(['CustomOrigin']['DNSName'])[0];
+ distListIndex = distListIndex[:len(uri.bucket())]
+ CloudFront.dist_list[distListIndex] = d.uri()
- # Skip over distributions with CustomOrigin
+ # Aral: I'm not sure when this condition will be reached, but keeping it in there.
debug("dist_list: %s" % CloudFront.dist_list)

0 comments on commit 23d133a

Please sign in to comment.
Something went wrong with that request. Please try again.