sr-scripts 0.0.10 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/sr-backup-mysql CHANGED
@@ -32,3 +32,14 @@ if pending
32
32
  end
33
33
  #p "./ec2-consistent-snapshot-rb -f conf.yml #{volumes.join(' ')}"
34
34
  `sr-ec2-consistent-snapshot -f /etc/sr-ec2-consistent-snapshot.yml #{volumes.join(' ')}`
35
+
36
+ # Purge the extra backups
37
+ volumes.each do |volume_id|
38
+ snapshots = connection.snapshots.all({"volume-id" => volume_id, "status" => "completed"}).sort { |a,b| b.created_at <=> a.created_at }
39
+ # Remove the first X number of snapshots to keep them
40
+ 5.times { snapshots.shift }
41
+
42
+ snapshots.each do |s|
43
+ connection.delete_snapshot s.id
44
+ end
45
+ end
@@ -1,5 +1,5 @@
1
1
  module Sr
2
2
  module Scripts
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sr-scripts
3
3
  version: !ruby/object:Gem::Version
4
- hash: 11
4
+ hash: 9
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 10
10
- version: 0.0.10
9
+ - 11
10
+ version: 0.0.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Davy Campano