elbas 0.25.0 → 0.26.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YWViZWU1MDQyNzgzYmYxNjc1YWQ0NWE0MmI4NTJiYzEyZTY1OTAyYg==
5
- data.tar.gz: !binary |-
6
- NWNjMzM3YWQyMjdlZmQzNTU3YTk1YzFkMTY5NmM5ZWJkY2ViMjQ1ZQ==
2
+ SHA1:
3
+ metadata.gz: 2722e17f36a9dfa01d1f92cc0d115168f4c5cd23
4
+ data.tar.gz: a101bd8682a20db2bf1760296537be0cb11ef243
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- MTlhNjk2NDFmZmVjNmM0MjlkMzc5ZGNkNDk0YjQxOTM2N2RlOWE3OWYxM2Y1
10
- ZWJhNzY4NGIwNDNlMmM0YzEyZjE4NDUzZjE0NTU0MmZlMGUwYTRiZWU1M2Iz
11
- OGJlNzY0MzU5YzQ4ZDAxZDFjMzRjMjc3NDRiNTM2OGRhMTg0NWU=
12
- data.tar.gz: !binary |-
13
- NTdiMmMyMzg5MGQwY2JjMTBkY2ZiY2ZiN2NjNGQzZjU3ZDcwNjIwM2EyMmRh
14
- Yzg4MDc3NmMwNzU0MDc4ZGMyMjFjOGE2NTYzZTlkMTA3NTBiNzYyZjMzYWY2
15
- YmM0NzRiOWU0MTJiMzhmODJjNWJjZTY1ZGYwNzQ1NmJiOWIwMWE=
6
+ metadata.gz: 6239692d050f4d0012abc97373ef491be6a15739ac621a34ea2b017cfd731f9602a14689debbc50ccafee057aa06890b361bec138befd3fc37b1f4f8249f8144
7
+ data.tar.gz: 352b2e32160b81cb3a12cd77921ed56ad5dc1943655d1848e8d1aa3c03d3d40d6b61936b2a16a80e32a235fafd6241948100af22c3dc94f10039918318430721
data/.gitignore CHANGED
@@ -1,3 +1,4 @@
1
+ bin/
1
2
  *.gem
2
3
  *.rbc
3
4
  /Gemfile.lock
@@ -24,6 +24,7 @@ module Elbas
24
24
  images.each do |i|
25
25
  info "Deleting old AMI: #{i.id}"
26
26
  i.delete
27
+ delete_snapshots_attached_to i
27
28
  end
28
29
  end
29
30
 
@@ -37,5 +38,12 @@ module Elbas
37
38
  deployed_with_elbas? ami
38
39
  end
39
40
  end
41
+
42
+ def delete_snapshots_attached_to(image)
43
+ image.block_device_mappings.each do |_, values|
44
+ snapshot = ec2.snapshots[values[:snapshot_id]]
45
+ snapshot.delete if snapshot.exists?
46
+ end
47
+ end
40
48
  end
41
49
  end
@@ -1,3 +1,3 @@
1
1
  module Elbas
2
- VERSION = '0.25.0'
2
+ VERSION = '0.26.0'
3
3
  end
@@ -3,16 +3,18 @@ describe 'ELBAS' do
3
3
  before do
4
4
  allow_any_instance_of(Elbas::AWSResource).to receive(:autoscale_group_name) { 'production' }
5
5
  webmock :get, /security-credentials/ => 'security-credentials.200.json'
6
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'DescribeImages.200.xml') { Hash[body: /Action=DescribeImages/] }
7
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'DescribeTags.200.xml') { Hash[body: /Action=DescribeTags/] }
8
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'DescribeInstances.200.xml') { Hash[body: /Action=DescribeInstances/] }
9
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'CreateImage.200.xml') { Hash[body: /Action=CreateImage/] }
10
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'DeregisterImage.200.xml') { Hash[body: /Action=DeregisterImage/] }
11
- webmock(:post, /ec2.(.*).amazonaws.com\/\z/ => 'CreateTags.200.xml') { Hash[body: /Action=CreateTags/] }
12
- webmock(:post, /autoscaling.(.*).amazonaws.com\/\z/ => 'DescribeLaunchConfigurations.200.xml') { Hash[body: /Action=DescribeLaunchConfigurations/] }
13
- webmock(:post, /autoscaling.(.*).amazonaws.com\/\z/ => 'CreateLaunchConfiguration.200.xml') { Hash[body: /Action=CreateLaunchConfiguration/] }
14
- webmock(:post, /autoscaling.(.*).amazonaws.com\/\z/ => 'DeleteLaunchConfiguration.200.xml') { Hash[body: /Action=DeleteLaunchConfiguration/] }
15
- webmock(:post, /autoscaling.(.*).amazonaws.com\/\z/ => 'UpdateAutoScalingGroup.200.xml') { Hash[body: /Action=UpdateAutoScalingGroup/] }
6
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeImages.200.xml') { Hash[body: /Action=DescribeImages/] }
7
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeTags.200.xml') { Hash[body: /Action=DescribeTags/] }
8
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeInstances.200.xml') { Hash[body: /Action=DescribeInstances/] }
9
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'CreateImage.200.xml') { Hash[body: /Action=CreateImage/] }
10
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DeregisterImage.200.xml') { Hash[body: /Action=DeregisterImage/] }
11
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'CreateTags.200.xml') { Hash[body: /Action=CreateTags/] }
12
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DescribeSnapshots.200.xml') { Hash[body: /Action=DescribeSnapshots/] }
13
+ webmock(:post, %r{ec2.(.*).amazonaws.com\/\z} => 'DeleteSnapshot.200.xml') { Hash[body: /Action=DeleteSnapshot/] }
14
+ webmock(:post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'DescribeLaunchConfigurations.200.xml') { Hash[body: /Action=DescribeLaunchConfigurations/] }
15
+ webmock(:post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'CreateLaunchConfiguration.200.xml') { Hash[body: /Action=CreateLaunchConfiguration/] }
16
+ webmock(:post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'DeleteLaunchConfiguration.200.xml') { Hash[body: /Action=DeleteLaunchConfiguration/] }
17
+ webmock(:post, %r{autoscaling.(.*).amazonaws.com\/\z} => 'UpdateAutoScalingGroup.200.xml') { Hash[body: /Action=UpdateAutoScalingGroup/] }
16
18
  end
17
19
 
18
20
  let!(:ami) do
@@ -30,6 +32,10 @@ describe 'ELBAS' do
30
32
  expect(WebMock).to have_requested(:post, /ec2.(.*).amazonaws.com\/\z/).with(body: /Action=DeregisterImage&ImageId=ami-1a2b3c4d/)
31
33
  end
32
34
 
35
+ it 'deletes snapshots that are associated with the AMI' do
36
+ expect(WebMock).to have_requested(:post, /ec2.(.*).amazonaws.com\/\z/).with(body: /Action=DeleteSnapshot&SnapshotId=snap-1a2b3c4d/)
37
+ end
38
+
33
39
  it 'tags the new AMI with Deployed-with=ELBAS' do
34
40
  expect(WebMock).to have_requested(:post, /ec2.(.*).amazonaws.com\/\z/).with(body: /Action=CreateTags&ResourceId.1=ami-4fa54026&Tag.1.Key=Deployed-with&Tag.1.Value=ELBAS/)
35
41
  end
@@ -60,5 +66,4 @@ describe 'ELBAS' do
60
66
  expect(WebMock).to have_requested(:post, /autoscaling.(.*).amazonaws.com\/\z/).with(body: /Action=UpdateAutoScalingGroup&AutoScalingGroupName=production&LaunchConfigurationName=ELBAS-production-production-LC-\d{10,}/)
61
67
  end
62
68
  end
63
-
64
69
  end
@@ -0,0 +1,4 @@
1
+ <DeleteSnapshotResponse xmlns="http://ec2.amazonaws.com/doc/2016-09-15/">
2
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
3
+ <return>true</return>
4
+ </DeleteSnapshotResponse>
@@ -0,0 +1,18 @@
1
+ <DescribeSnapshotsResponse xmlns="http://ec2.amazonaws.com/doc/2016-09-15/">
2
+ <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
3
+ <snapshotSet>
4
+ <item>
5
+ <snapshotId>snap-1a2b3c4d</snapshotId>
6
+ <volumeId>vol-1234567890abcdef0</volumeId>
7
+ <status>pending</status>
8
+ <startTime>2013-01-21T23:04:42.200Z</startTime>
9
+ <progress>80%</progress>
10
+ <ownerId>111122223333</ownerId>
11
+ <volumeSize>15</volumeSize>
12
+ <description>Daily Backup</description>
13
+ <encrypted>true</encrypted>
14
+ <kmsKeyId>arn:aws:kms:us-east-1:123456789012:key/6876fb1b-example</kmsKeyId>
15
+ <tagSet/>
16
+ </item>
17
+ </snapshotSet>
18
+ </DescribeSnapshotsResponse>
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elbas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-25 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aws-sdk-v1
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: capistrano
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>'
87
+ - - ">"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 3.0.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>'
94
+ - - ">"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 3.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: activesupport
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ! '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 4.0.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ! '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 4.0.0
111
111
  description: Capistrano plugin for deploying to AWS AutoScale Groups. Deploys to all
@@ -117,9 +117,9 @@ executables: []
117
117
  extensions: []
118
118
  extra_rdoc_files: []
119
119
  files:
120
- - .gitignore
121
- - .rspec
122
- - .travis.yml
120
+ - ".gitignore"
121
+ - ".rspec"
122
+ - ".travis.yml"
123
123
  - Gemfile
124
124
  - LICENSE.txt
125
125
  - README.md
@@ -145,10 +145,12 @@ files:
145
145
  - spec/support/stubs/CreateLaunchConfiguration.200.xml
146
146
  - spec/support/stubs/CreateTags.200.xml
147
147
  - spec/support/stubs/DeleteLaunchConfiguration.200.xml
148
+ - spec/support/stubs/DeleteSnapshot.200.xml
148
149
  - spec/support/stubs/DeregisterImage.200.xml
149
150
  - spec/support/stubs/DescribeImages.200.xml
150
151
  - spec/support/stubs/DescribeInstances.200.xml
151
152
  - spec/support/stubs/DescribeLaunchConfigurations.200.xml
153
+ - spec/support/stubs/DescribeSnapshots.200.xml
152
154
  - spec/support/stubs/DescribeTags.200.xml
153
155
  - spec/support/stubs/UpdateAutoScalingGroup.200.xml
154
156
  - spec/support/stubs/security-credentials.200.json
@@ -162,12 +164,12 @@ require_paths:
162
164
  - lib
163
165
  required_ruby_version: !ruby/object:Gem::Requirement
164
166
  requirements:
165
- - - ! '>='
167
+ - - ">="
166
168
  - !ruby/object:Gem::Version
167
169
  version: '0'
168
170
  required_rubygems_version: !ruby/object:Gem::Requirement
169
171
  requirements:
170
- - - ! '>='
172
+ - - ">="
171
173
  - !ruby/object:Gem::Version
172
174
  version: '0'
173
175
  requirements: []
@@ -184,10 +186,12 @@ test_files:
184
186
  - spec/support/stubs/CreateLaunchConfiguration.200.xml
185
187
  - spec/support/stubs/CreateTags.200.xml
186
188
  - spec/support/stubs/DeleteLaunchConfiguration.200.xml
189
+ - spec/support/stubs/DeleteSnapshot.200.xml
187
190
  - spec/support/stubs/DeregisterImage.200.xml
188
191
  - spec/support/stubs/DescribeImages.200.xml
189
192
  - spec/support/stubs/DescribeInstances.200.xml
190
193
  - spec/support/stubs/DescribeLaunchConfigurations.200.xml
194
+ - spec/support/stubs/DescribeSnapshots.200.xml
191
195
  - spec/support/stubs/DescribeTags.200.xml
192
196
  - spec/support/stubs/UpdateAutoScalingGroup.200.xml
193
197
  - spec/support/stubs/security-credentials.200.json