awsome 0.0.39 → 0.0.40
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/lib/awsome/ec2/instance.rb +27 -24
- data/lib/awsome/elb/load_balancer.rb +4 -0
- data/lib/awsome/matchmaker.rb +24 -19
- data/lib/awsome/requirements.rb +24 -18
- metadata +1 -1
data/lib/awsome/ec2/instance.rb
CHANGED
@@ -84,25 +84,28 @@ module Awsome
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def self.to_table(instances)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
]
|
103
|
-
t << :separator unless i == instances.length-1
|
104
|
-
end
|
87
|
+
rows = []
|
88
|
+
|
89
|
+
# add instance rows
|
90
|
+
instances.each do |instance|
|
91
|
+
rows << [
|
92
|
+
instance.packages.to_a.join("\n"),
|
93
|
+
instance.volumes.to_a.join("\n"),
|
94
|
+
instance.elbs.collect(&:name).join("\n"),
|
95
|
+
instance.ami_id,
|
96
|
+
instance.key,
|
97
|
+
instance.instance_type,
|
98
|
+
instance.availability_zone,
|
99
|
+
instance.security_group_ids
|
100
|
+
]
|
101
|
+
rows << :separator
|
105
102
|
end
|
103
|
+
|
104
|
+
# remove last unnecessary separator
|
105
|
+
rows.pop if rows.any?
|
106
|
+
|
107
|
+
headings = %w(packages volumes elbs ami key type zone secgroup)
|
108
|
+
Terminal::Table.new :headings => headings, :rows => rows
|
106
109
|
end
|
107
110
|
|
108
111
|
def elbs
|
@@ -110,27 +113,27 @@ module Awsome
|
|
110
113
|
end
|
111
114
|
|
112
115
|
def id
|
113
|
-
properties['instance_id']
|
116
|
+
@properties['instance_id']
|
114
117
|
end
|
115
118
|
|
116
119
|
def ami_id
|
117
|
-
properties['ami_id']
|
120
|
+
@properties['ami_id']
|
118
121
|
end
|
119
122
|
|
120
123
|
def key
|
121
|
-
properties['key']
|
124
|
+
@properties['key']
|
122
125
|
end
|
123
126
|
|
124
127
|
def instance_type
|
125
|
-
properties['instance_type']
|
128
|
+
@properties['instance_type']
|
126
129
|
end
|
127
130
|
|
128
131
|
def availability_zone
|
129
|
-
properties['availability_zone']
|
132
|
+
@properties['availability_zone']
|
130
133
|
end
|
131
134
|
|
132
135
|
def security_group_ids
|
133
|
-
properties['security_group_ids']
|
136
|
+
@properties['security_group_ids']
|
134
137
|
end
|
135
138
|
|
136
139
|
private
|
data/lib/awsome/matchmaker.rb
CHANGED
@@ -34,27 +34,32 @@ module Awsome
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.to_table(matches)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
37
|
+
rows = []
|
38
|
+
|
39
|
+
# enumerate match rows
|
40
|
+
matches.each do |signature, match|
|
41
|
+
match['i_pool'].each_with_index do |i, idx|
|
42
|
+
r = match['r_pool'][idx]
|
43
|
+
rows << [
|
44
|
+
i.nil? ? '(new)' : i.id,
|
45
|
+
r.packages.join("\n"),
|
46
|
+
r.volumes.join("\n"),
|
47
|
+
r.elbs.join("\n"),
|
48
|
+
r.ami_id,
|
49
|
+
r.key,
|
50
|
+
r.instance_type,
|
51
|
+
r.availability_zone,
|
52
|
+
r.security_group_ids,
|
53
|
+
]
|
54
|
+
rows << :separator
|
56
55
|
end
|
57
56
|
end
|
57
|
+
|
58
|
+
# remove last unnecessary separator
|
59
|
+
rows.pop if rows.any?
|
60
|
+
|
61
|
+
headings = %w(instance packages volumes elbs ami key type zone secgroup)
|
62
|
+
Terminal::Table.new :headings => headings, :rows => rows
|
58
63
|
end
|
59
64
|
|
60
65
|
private
|
data/lib/awsome/requirements.rb
CHANGED
@@ -31,25 +31,31 @@ module Awsome
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.to_table(requirements)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
34
|
+
rows = []
|
35
|
+
|
36
|
+
#add requirement rows
|
37
|
+
requirements.each do |req|
|
38
|
+
rows << [
|
39
|
+
req.tags.collect { |v| "#{v[0]}: #{v[1]}" }.join("\n"),
|
40
|
+
req.packages.to_a.join("\n"),
|
41
|
+
req.volumes.to_a.join("\n"),
|
42
|
+
req.elbs.join("\n"),
|
43
|
+
req.elastic_ips.join("\n"),
|
44
|
+
req.cnames.collect{|c|c['names']}.flatten.join("\n"),
|
45
|
+
req.ami_id,
|
46
|
+
req.key,
|
47
|
+
req.instance_type,
|
48
|
+
req.availability_zone,
|
49
|
+
req.security_group_ids
|
50
|
+
]
|
51
|
+
rows << :separator
|
52
52
|
end
|
53
|
+
|
54
|
+
# remove last unnecessary separator
|
55
|
+
rows.pop if rows.any?
|
56
|
+
|
57
|
+
headings = %w(tags packages volumes elbs elasticips cnames ami key type zone secgroup)
|
58
|
+
Terminal::Table.new :headings => headings, :rows => rows
|
53
59
|
end
|
54
60
|
|
55
61
|
private
|