aws-ec2 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +1 -1
- data/lib/aws_ec2/cleaner/ami.rb +3 -3
- data/lib/aws_ec2/help/clean/ami.md +4 -4
- data/lib/aws_ec2/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25ed3f964ac1b46d2ba36889dea2d02b6196bbc0a2aeb455528873e3103b255c
|
4
|
+
data.tar.gz: acbb597967043091532f4d44aa78a22202ee09080b351a43e3e12f855f70117b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16683a497d46c764ab49f69738da3e755431fa9c5c4b95c1efee249621fd40ab3c51bf2c848168674273f4597e11e2e7f606ab543ad041b2e31fe9fcbf9b4229
|
7
|
+
data.tar.gz: 28177138d601571e7a76a0c708190b76b9a3f9193b12fd0fb069641cfa800bdd68a63ce35183b415c36771217cdb8b3f230819663120374aae8dd982b2ea9198
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.3.1]
|
7
|
+
- fix cleaning so it cleans out the oldest images
|
8
|
+
|
6
9
|
## [1.3.0]
|
7
10
|
- Merge pull request #7 from tongueroo/clean: aws-ec2 clean ami command
|
8
11
|
|
data/Gemfile.lock
CHANGED
data/lib/aws_ec2/cleaner/ami.rb
CHANGED
@@ -3,18 +3,18 @@ module AwsEc2::Cleaner
|
|
3
3
|
include AwsEc2::AwsService
|
4
4
|
|
5
5
|
def clean
|
6
|
-
query = @options[:query]
|
6
|
+
query = @options[:query]
|
7
7
|
keep = @options[:keep] || 2
|
8
8
|
puts "Cleaning out old AMIs with base name: #{@options[:query]}"
|
9
9
|
return if ENV['TEST']
|
10
10
|
|
11
11
|
images = search_ami(query)
|
12
|
-
images.sort_by
|
12
|
+
images = images.sort_by { |i| i.name }.reverse
|
13
13
|
delete_list = images[keep..-1] || []
|
14
14
|
puts "Deleting #{delete_list.size} images."
|
15
15
|
delete_list.each do |i|
|
16
16
|
puts "Deleting image: #{i.image_id} #{i.name}"
|
17
|
-
delete(i.image_id)
|
17
|
+
# delete(i.image_id)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Examples:
|
2
2
|
|
3
|
-
$ aws-ec2 clean ami base-amazonlinux2
|
4
|
-
$ aws-ec2 clean ami base-ubuntu --keep 5
|
3
|
+
$ aws-ec2 clean ami 'base-amazonlinux2*'
|
4
|
+
$ aws-ec2 clean ami 'base-ubuntu*' --keep 5
|
5
5
|
|
6
6
|
Deletes old AMIs using the provided name as the base portion of the AMI name to search for.
|
7
7
|
|
@@ -16,6 +16,6 @@ Let's say you have these images:
|
|
16
16
|
|
17
17
|
Running:
|
18
18
|
|
19
|
-
$ aws-ec2 clean ami base-ubuntu
|
19
|
+
$ aws-ec2 clean ami 'base-ubuntu*'
|
20
20
|
|
21
|
-
Would delete all images and keep the 2 most recent AMIs. The default `--keep` value is 2.
|
21
|
+
Would delete all images and keep the 2 most recent AMIs. The default `--keep` value is 2. Make sure to surround the query pattern with a single quote to prevent shell glob expansion.
|
data/lib/aws_ec2/version.rb
CHANGED