awsome 0.0.41 → 0.0.42
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/awsome +3 -3
- data/lib/awsome/ec2/instance.rb +2 -2
- data/lib/awsome/matchmaker.rb +4 -4
- data/lib/awsome/requirements.rb +2 -2
- metadata +1 -1
data/bin/awsome
CHANGED
@@ -34,18 +34,18 @@ matches = nil
|
|
34
34
|
|
35
35
|
perform_task "Gathering Instance Requirements" do
|
36
36
|
requirements = Awsome::Requirements.from_yaml_file(requirements_file)
|
37
|
-
puts Awsome::Requirements.to_table(requirements.instances)
|
37
|
+
puts Awsome::Requirements.to_table(requirements.instances, 'Required Instances')
|
38
38
|
end
|
39
39
|
|
40
40
|
perform_task "Analyzing Running Instances" do
|
41
41
|
filters = {'instance-state-name' => 'running'}.merge(requirements.filters)
|
42
42
|
instances = Awsome::Ec2.describe_instances(filters)
|
43
|
-
puts Awsome::Ec2::Instance.to_table(instances)
|
43
|
+
puts Awsome::Ec2::Instance.to_table(instances, 'Running Instances')
|
44
44
|
end
|
45
45
|
|
46
46
|
perform_task "Matching Requirements to Instances" do
|
47
47
|
matches = Awsome::Matchmaker.new(instances, requirements).matches
|
48
|
-
puts Awsome::Matchmaker.to_table(matches)
|
48
|
+
puts Awsome::Matchmaker.to_table(matches, 'Requirement/Instance Match Plan')
|
49
49
|
end
|
50
50
|
|
51
51
|
perform_task "Executing Plan" do
|
data/lib/awsome/ec2/instance.rb
CHANGED
@@ -83,7 +83,7 @@ module Awsome
|
|
83
83
|
Awsome::Ec2.create_tags(@properties['instance_id'], tags)
|
84
84
|
end
|
85
85
|
|
86
|
-
def self.to_table(instances)
|
86
|
+
def self.to_table(instances, title='Instances')
|
87
87
|
rows = []
|
88
88
|
|
89
89
|
# add instance rows
|
@@ -105,7 +105,7 @@ module Awsome
|
|
105
105
|
rows.pop if rows.any?
|
106
106
|
|
107
107
|
headings = %w(packages volumes elbs ami key type zone secgroup)
|
108
|
-
Terminal::Table.new :headings => headings, :rows => rows
|
108
|
+
Terminal::Table.new :headings => headings, :rows => rows, :title => title
|
109
109
|
end
|
110
110
|
|
111
111
|
def elbs
|
data/lib/awsome/matchmaker.rb
CHANGED
@@ -33,13 +33,13 @@ module Awsome
|
|
33
33
|
@signatures.reduce({}) { |memo, s| memo.merge(s => best_match(s)) }
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.to_table(matches)
|
36
|
+
def self.to_table(matches, title='Matches')
|
37
37
|
rows = []
|
38
38
|
|
39
39
|
# enumerate match rows
|
40
40
|
matches.each do |signature, match|
|
41
|
-
match[
|
42
|
-
r = match[
|
41
|
+
match[:i_pool].each_with_index do |i, idx|
|
42
|
+
r = match[:r_pool][idx]
|
43
43
|
rows << [
|
44
44
|
i.nil? ? '(new)' : i.id,
|
45
45
|
r.packages.join("\n"),
|
@@ -59,7 +59,7 @@ module Awsome
|
|
59
59
|
rows.pop if rows.any?
|
60
60
|
|
61
61
|
headings = %w(instance packages volumes elbs ami key type zone secgroup)
|
62
|
-
Terminal::Table.new :headings => headings, :rows => rows
|
62
|
+
Terminal::Table.new :headings => headings, :rows => rows, :title => title
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
data/lib/awsome/requirements.rb
CHANGED
@@ -30,7 +30,7 @@ module Awsome
|
|
30
30
|
@requirements['traits'] || {}
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.to_table(requirements)
|
33
|
+
def self.to_table(requirements, title='Requirements')
|
34
34
|
rows = []
|
35
35
|
|
36
36
|
#add requirement rows
|
@@ -55,7 +55,7 @@ module Awsome
|
|
55
55
|
rows.pop if rows.any?
|
56
56
|
|
57
57
|
headings = %w(tags packages volumes elbs elasticips cnames ami key type zone secgroup)
|
58
|
-
Terminal::Table.new :headings => headings, :rows => rows
|
58
|
+
Terminal::Table.new :headings => headings, :rows => rows, :title => title
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|