automan 2.1.2 → 2.1.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 51034f65211eb254e16dda913be2911ab509932e
4
- data.tar.gz: 3af18906f79765fde866c0deb13998930e7bf9fb
3
+ metadata.gz: 5ff89fd6445234583d2dde7e5fa84d345cfdc736
4
+ data.tar.gz: bf206d9978acd7cb472388df2bc8073b23af6443
5
5
  SHA512:
6
- metadata.gz: e0004f92017b780b531561e2edd234d7f99f77ed8ae27680f3dd0d93535e5337cc88dac6a5214a1fa52f9438cc641df5bb4f5cc1a32947537e8bb3c8c34bb046
7
- data.tar.gz: 47f1121011e1e4f4c50e17d55ed81a713c4dc8d43295e14f2f7012aeade25660050c1f35ca31943be861f91119483f265856ea54d4e5c960f09757551710a41c
6
+ metadata.gz: ce434b18f4b4dd0a597a075719088fa4258bd2196baeca16668e3218099c5b232397f22a136001d0514e41dcf19b0a6e7e0e538c373e463d744d3aaa4c35af46
7
+ data.tar.gz: 85a6e482d61a528271e3736b9c425b5976174986410992532a84b34e602d0690c393216dadf6b91f12e3e448bdaab7c48147b6f67bad3431206f1e72863ff96b
data/Rakefile CHANGED
@@ -1,6 +1 @@
1
1
  require "bundler/gem_tasks"
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
@@ -74,5 +74,26 @@ module Automan::Cli
74
74
  Automan::RDS::Snapshot.new(options).latest
75
75
  end
76
76
 
77
+ desc "count", "return the number of snapshots"
78
+
79
+ option :environment,
80
+ aliases: "-e",
81
+ desc: "environment of database to snapshot"
82
+
83
+ option :database,
84
+ aliases: "-d",
85
+ desc: "name of the database to snapshot"
86
+
87
+ def count
88
+
89
+ if options[:database].nil? && options[:environment].nil?
90
+ puts "Must specify either database or environment"
91
+ help "count"
92
+ exit 1
93
+ end
94
+
95
+ Automan::RDS::Snapshot.new(options).count_snapshots
96
+ end
97
+
77
98
  end
78
99
  end
@@ -63,7 +63,7 @@ module Automan::RDS
63
63
  end
64
64
 
65
65
  def snapshot_count
66
- rds.db_instances[database].snapshots.count
66
+ rds.db_instances[find_db.id].snapshots.count
67
67
  end
68
68
 
69
69
  def create
@@ -204,12 +204,14 @@ module Automan::RDS
204
204
  end
205
205
 
206
206
  def get_all_snapshots
207
- rds.db_snapshots
207
+ rds.db_instances[find_db.id].snapshots
208
208
  end
209
209
 
210
210
  def prunable_snapshots
211
- snapshots = get_all_snapshots
212
- snapshots.select { |s| can_prune?(s) }
211
+ AWS.memoize do
212
+ snapshots = get_all_snapshots
213
+ snapshots.select { |s| can_prune?(s) }
214
+ end
213
215
  end
214
216
 
215
217
  def oldest_prunable_snapshot
@@ -233,6 +235,17 @@ module Automan::RDS
233
235
  end
234
236
  end
235
237
 
238
+ def count_snapshots
239
+ log_options
240
+ db = find_db
241
+ if db.nil?
242
+ logger.info "Database not found"
243
+ else
244
+ logger.info "Number of snapshots for database #{db.id} is #{snapshot_count}"
245
+ logger.info "Number of prunable snapshots for database #{db.id} is #{prunable_snapshots.count}"
246
+ end
247
+ end
248
+
236
249
  def latest
237
250
  log_options
238
251
  db = find_db
@@ -241,4 +254,4 @@ module Automan::RDS
241
254
  logger.info "Most recent snapshot is #{s.id}"
242
255
  end
243
256
  end
244
- end
257
+ end
@@ -1,3 +1,3 @@
1
1
  module Automan
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: automan
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Chalfant
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-11 00:00:00.000000000 Z
12
+ date: 2015-10-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -166,8 +166,6 @@ extensions: []
166
166
  extra_rdoc_files: []
167
167
  files:
168
168
  - ".gitignore"
169
- - ".rvmrc"
170
- - ".travis.yml"
171
169
  - Gemfile
172
170
  - LICENSE.txt
173
171
  - README.md
@@ -252,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
250
  version: '0'
253
251
  requirements: []
254
252
  rubyforge_project:
255
- rubygems_version: 2.2.2
253
+ rubygems_version: 2.4.8
256
254
  signing_key:
257
255
  specification_version: 4
258
256
  summary: Automates common AWS ops
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm --create use ruby-2.1.2@automan
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - "2.1.2"
4
- # uncomment this line if your project needs to run something other than `rake`:
5
- # script: bundle exec rspec spec