opzworks 0.12.2 → 0.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcd741d5868f5f985989a0f93ef42c4c96a77d1e
4
- data.tar.gz: 187694894b5e955f00b7ff7f977950f336ef0019
3
+ metadata.gz: e967928f87239b584f45d8af269bd48662b80171
4
+ data.tar.gz: 40f04139f1ef3457f1a8f027f71712b87c2539fa
5
5
  SHA512:
6
- metadata.gz: dad99d1a3a6dc7185415fde0be6489108e8de41145b89a0569fb951c145ae55a669660d4d28c42f880a547a1da59b596dc5b4bfe4099aa3dcd1f653ee8e01b87
7
- data.tar.gz: e28b6d2c5c1fd16c9866ce5fb710f0a44f94bbfc5370b2cfa0dc59f5ea6e4117fc852b672f671300f177f786478614a0a971c16f9a3bcc234892868b159016b5
6
+ metadata.gz: 25dd95265c036d91cc21b283a673b706c91a52afa500a3410a82f76a48bb48cf903a39b11a89ce113968134a2a8fd13a658d72002e9a63342f52de522423b2f5
7
+ data.tar.gz: 586bb8b49770c926c06eecdb15113b41266f0725896b86350167f4565287b38bbd83522b01e793067c72c66d533d8e4698d7be561950dda11865f8bf58094935
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  changelog
2
2
  =========
3
3
 
4
+ 0.12.3
5
+ ------
6
+ * cull backups
7
+
4
8
  0.12.2
5
9
  ------
6
10
  * bug fix
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opzworks (0.11.1)
4
+ opzworks (0.12.2)
5
5
  aws-sdk (~> 2.2.37)
6
6
  diffy (~> 3.1.0)
7
7
  faraday (~> 0.9.2)
data/circle.yml CHANGED
@@ -4,3 +4,6 @@ machine:
4
4
  test:
5
5
  override:
6
6
  - bundle exec rake
7
+ dependencies:
8
+ pre:
9
+ - gem install bundler -v 1.11.2
@@ -137,6 +137,42 @@ module OpzWorks
137
137
  end
138
138
  end
139
139
 
140
+ begin
141
+ cull = s3_client.list_objects(
142
+ bucket: s3_bucket,
143
+ prefix: "#{@s3_path}/#{cookbook_tarball}-"
144
+ )
145
+ rescue Aws::S3::Errors::ServiceError => e
146
+ puts "Caught exception trying to list backups in #{s3_bucket}:".foreground(:red)
147
+ puts "\t#{e}"
148
+ else
149
+ backup_arr = []
150
+ cull.contents.each { |k,v| backup_arr << k.key }
151
+ backup_arr.pop(5) # keep last 5 backups
152
+
153
+ if backup_arr.length != 0
154
+ delete_arr = []
155
+ while backup_arr.length > 0
156
+ puts "Adding backup #{backup_arr[0]} to the cull list".foreground(:green)
157
+ delete_arr << backup_arr.pop
158
+
159
+ arr_of_hash = []
160
+ delete_arr.each { |i| arr_of_hash << { 'key': i } }
161
+
162
+ puts 'Culling old backups'.foreground(:green)
163
+ begin
164
+ s3_client.delete_objects(
165
+ bucket: s3_bucket,
166
+ delete: { objects: arr_of_hash }
167
+ )
168
+ rescue Aws::S3::Errors::ServiceError => e
169
+ puts "Caught exception trying to delete backups in #{s3_bucket}:".foreground(:red)
170
+ puts "\t#{e}"
171
+ end
172
+ end
173
+ end
174
+ end
175
+
140
176
  # upload
141
177
  puts "\nUploading to S3".foreground(:blue)
142
178
  begin
data/lib/opzworks/meta.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module OpzWorks
3
- VERSION = '0.12.2'.freeze
3
+ VERSION = '0.12.3'.freeze
4
4
  AUTHORS = ['Grant Heffernan', 'Mapzen'].freeze
5
5
  EMAIL = ['grant@mapzen.com'].freeze
6
6
  DESCRIPTION = 'OpzWorks Utilities'.freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opzworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Heffernan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-27 00:00:00.000000000 Z
12
+ date: 2016-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk