diff options
author | Chris Moyer <kopertop@gmail.com> | 2012-10-09 19:05:28 -0400 |
---|---|---|
committer | Chris Moyer <kopertop@gmail.com> | 2012-10-09 19:05:28 -0400 |
commit | 881d873f06dafc5610408665ee43f02e60bcb252 (patch) | |
tree | 2549299fa761f14aa4a2a912a2ad0c453bfeffdf | |
parent | ba796ddd8a7efe7c0756bddb6e48e4e110c7cf09 (diff) | |
download | boto-881d873f06dafc5610408665ee43f02e60bcb252.tar.gz |
Added "listinvalidations" command to cfadmin, allowing you to see the
pending and completed invalidation requests for any given cloudfront
domain
-rwxr-xr-x | bin/cfadmin | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bin/cfadmin b/bin/cfadmin index 70734525..6fcdd86d 100755 --- a/bin/cfadmin +++ b/bin/cfadmin @@ -65,6 +65,26 @@ def invalidate(cf, origin_or_id, *paths): sys.exit(1) cf.create_invalidation_request(dist.id, paths) +def listinvalidations(cf, origin_or_id): + """List invalidation requests for a given origin""" + dist = None + for d in cf.get_all_distributions(): + if d.id == origin_or_id or d.origin.dns_name == origin_or_id: + dist = d + break + if not dist: + print "Distribution not found: %s" % origin_or_id + sys.exit(1) + results = cf.get_invalidation_requests(dist.id) + if results: + for result in results: + if result.status == "InProgress": + result = result.get_invalidation_request() + print result.id, result.status, result.paths + else: + print result.id, result.status + + if __name__ == "__main__": import boto import sys |