Skip to content

Commit

Permalink
support a list of cloudfront IDs to be invalidated
Browse files Browse the repository at this point in the history
  • Loading branch information
dryan committed Jan 30, 2018
1 parent 2015d65 commit 0ac2817
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions d3ploy/d3ploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from boto.s3.connection import OrdinaryCallingFormat

VERSION = '2.2.2'
VERSION = '2.2.3'

warnings.filterwarnings('ignore')

Expand Down Expand Up @@ -486,14 +486,17 @@ def upload_files(env):
(deleted, verb), color=ALERT_COLOR)
cloudfront_id = environ_config.get('cloudfront', None)
if cloudfront_id:
if args.dry_run:
notify(args.environment, "CloudFront distribution {} invalidation would be requested".format(
cloudfront_id), color=OK_COLOR)
else:
cloudfront = boto.connect_cloudfront(KEY, SECRET)
cloudfront.create_invalidation_request(cloudfront_id, ['*'])
notify(args.environment, "CloudFront distribution {} invalidation requested".format(
cloudfront_id), color=OK_COLOR)
if not isinstance(cloudfront_id, list):
cloudfront_id = [cloudfront_id]
for cf_id in cloudfront_id:
if args.dry_run:
notify(args.environment, "CloudFront distribution {} invalidation would be requested".format(
cf_id), color=OK_COLOR)
else:
cloudfront = boto.connect_cloudfront(KEY, SECRET)
cloudfront.create_invalidation_request(cf_id, ['*'])
notify(args.environment, "CloudFront distribution {} invalidation requested".format(
cf_id), color=OK_COLOR)


if args.environment not in config:
Expand Down

0 comments on commit 0ac2817

Please sign in to comment.