instance_selector 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/instance_selector +26 -8
- data/lib/instance_selector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9623a48c51d1a7fffa815c7432857ef84e2b6fce
|
4
|
+
data.tar.gz: 2afa2b4aebf772ae0c28ed392f0c55701eec19cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc76565667a69829f480081bde6460504be8758f0853f680c48441cf36ec7e17f735a41dba853a42baad217cae97d29287c4ee27b7f10b7e3180690bc58b432
|
7
|
+
data.tar.gz: cd59a0c2aa1712a7d63742f8145e710d4ec7864907650305a9d49ea23db3fa5a8b744a7d70a6a510553a52fcc84632038c8e3cf623dcf2834a157a5e11d78bff
|
data/bin/instance_selector
CHANGED
@@ -8,16 +8,34 @@ opts = Slop.parse do
|
|
8
8
|
|
9
9
|
on 'e=', 'environment=', "The environment servers are tagged with"
|
10
10
|
on 'r=', 'role=', "The role servers are tagged with"
|
11
|
+
# on 't', 'tag-spots', "If the spot instances aren't tagged, update them"
|
12
|
+
on 'v', 'verbose', "Print more info about the instances"
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
filters["tag:Environment"] = opts[:e]
|
15
|
+
filters = {}
|
16
|
+
filters["tag:Role"] = opts[:r] if opts[:r]
|
17
|
+
filters["tag:Environment"] = opts[:e] if opts[:e]
|
17
18
|
|
18
|
-
|
19
|
-
instances = client.instances(filters)
|
20
|
-
instances.each {|i| puts i[0]}
|
21
|
-
else
|
19
|
+
unless opts[:e] || opts[:r]
|
22
20
|
puts opts
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
client = InstanceSelector::Connection.factory(:aws)
|
25
|
+
instances = client.instances(filters)
|
26
|
+
|
27
|
+
instances.each do |i|
|
28
|
+
print i[0]
|
29
|
+
print "\t" if (opts[:v] && (i[0].size+1) % 8 < 1)
|
30
|
+
print "\t" + i[1] if opts[:v]
|
31
|
+
print "\n"
|
32
|
+
|
33
|
+
# TODO: Convert instances to an object to associate more data with it, and move tagging to method in providers
|
34
|
+
# if opts[:t] && i[1].nil? && i[1] != ""
|
35
|
+
# tags = {}
|
36
|
+
# tags["Role"] = opts[:r] if opts[:r]
|
37
|
+
# tags["Environment"] = opts[:e] if opts[:e]
|
38
|
+
# tags["Name"] = "#{opts[:e]}-#{opts[:r]}"
|
39
|
+
# client.tag
|
40
|
+
# end
|
23
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instance_selector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin McFadden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|