poolparty 1.4.5 → 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :minor: 4
3
- :patch: 5
3
+ :patch: 6
4
4
  :major: 1
5
5
  :build:
data/bin/cloud-list CHANGED
@@ -35,7 +35,7 @@ EOS
35
35
  msg << "#{k.capitalize} nodes"
36
36
  msg << line
37
37
  v.each do |a|
38
- msg << " #{a.instance_id}\t#{a.status}\t#{a.public_ip}\t#{a.dns_name}"
38
+ msg << " #{a.instance_id}\t#{a.status}\t#{a.public_ip}\t#{a.private_ip}\t#{a.dns_name}"
39
39
  end
40
40
  msg << ""
41
41
  end
@@ -162,7 +162,7 @@ module CloudProviders
162
162
  :max_count => num,
163
163
  :key_name => keypair.basename,
164
164
  :security_groups => security_groups,
165
- :user_data => user_data,
165
+ :user_data => decoded_user_data,
166
166
  :instance_type => instance_type,
167
167
  :availability_zone => availability_zones.first,
168
168
  :base64_encoded => true,
@@ -174,6 +174,16 @@ module CloudProviders
174
174
  all_nodes.detect {|n| n.instance_id == e.instance_id }
175
175
  end
176
176
 
177
+ def decoded_user_data
178
+ if user_data
179
+ if File.file?(user_data)
180
+ open(user_data).read
181
+ else
182
+ user_data
183
+ end
184
+ end
185
+ end
186
+
177
187
  def wait_for_node(instance)
178
188
  reset!
179
189
  inst = all_nodes.detect {|n| n.instance_id == instance.instance_id }
@@ -7,26 +7,31 @@ module CloudProviders
7
7
  :network => "0.0.0.0/0",
8
8
  :group_name => nil,
9
9
  :owner_id => nil})
10
-
10
+
11
11
  def run
12
- puts "Authorizing: #{name} for #{protocol} to #{from_port}:#{to_port} #{network}"
13
12
  options =
14
13
  if group_name
14
+ puts "Authorizing #{name} for group named: #{group_name} of owner id: #{owner_id}"
15
15
  {:authorize_security_group_ingress => group_name, :source_security_group_owner_id => owner_id}
16
16
  else
17
+ puts "Authorizing: #{name} for #{protocol} to #{from_port}:#{to_port} #{network}"
17
18
  to_hash
18
19
  end
19
20
  ec2.authorize_security_group_ingress(options) rescue nil
20
21
  end
21
22
 
22
23
  def to_hash
23
- {
24
- :group_name => name,
25
- :ip_protocol => protocol,
26
- :from_port => from_port,
27
- :to_port => to_port,
28
- :cidr_ip => network
29
- }
24
+ if group_name
25
+ {:group_name => group_name}
26
+ else
27
+ {
28
+ :group_name => name,
29
+ :ip_protocol => protocol,
30
+ :from_port => from_port,
31
+ :to_port => to_port,
32
+ :cidr_ip => network
33
+ }
34
+ end
30
35
  end
31
36
 
32
37
  end
@@ -26,5 +26,9 @@ module CloudProviders
26
26
  cloud.as
27
27
  end
28
28
 
29
+ def pool
30
+ cloud.parent
31
+ end
32
+
29
33
  end
30
34
  end
@@ -7,24 +7,30 @@ module CloudProviders
7
7
  end
8
8
  current_security_groups = security_groups.map {|a|
9
9
  a[:ip_permissions].map do |perm|
10
- if perm[:ip_ranges].size > 1
11
- perm[:ip_ranges].map do |range|
10
+ if perm[:group_name]
11
+ {
12
+ :group_name => perm[:group_name]
13
+ }
14
+ else
15
+ if perm[:ip_ranges].size > 1
16
+ perm[:ip_ranges].map do |range|
17
+ {
18
+ :group_name => a[:name],
19
+ :from_port => perm[:from_port],
20
+ :to_port => perm[:to_port],
21
+ :cidr_ip => range,
22
+ :ip_protocol => perm[:protocol]
23
+ }.flatten
24
+ end.flatten
25
+ else
12
26
  {
13
27
  :group_name => a[:name],
14
- :from_port => perm[:from_port],
28
+ :from_port => perm[:from_port],
15
29
  :to_port => perm[:to_port],
16
- :cidr_ip => range,
30
+ :cidr_ip => perm[:ip_ranges].map {|c| c[:cidrIp] }.first, # first for simplicity for now...
17
31
  :ip_protocol => perm[:protocol]
18
- }.flatten
19
- end.flatten
20
- else
21
- {
22
- :group_name => a[:name],
23
- :from_port => perm[:from_port],
24
- :to_port => perm[:to_port],
25
- :cidr_ip => perm[:ip_ranges].map {|c| c[:cidrIp] }.first, # first for simplicity for now...
26
- :ip_protocol => perm[:protocol]
27
- }
32
+ }
33
+ end
28
34
  end
29
35
  end.flatten
30
36
  }.flatten
@@ -125,6 +125,12 @@ log_level :info
125
125
  ca.to_dna _recipes.map {|a| File.basename(a) }, to
126
126
  end
127
127
 
128
+ # The pool can either be the parent (the context where the object is declared)
129
+ # or the global pool object
130
+ def pool
131
+ parent || pool
132
+ end
133
+
128
134
  def tmp_path
129
135
  "/tmp/poolparty" / pool.name / name
130
136
  end
@@ -148,16 +154,7 @@ log_level :info
148
154
  end
149
155
  end
150
156
  end
151
-
152
- # proxy to cloud_provider
153
- # def method_missing(m,*a,&block)
154
- # if cloud_provider.respond_to?(m)
155
- # cloud_provider.send(m,*a,&block)
156
- # else
157
- # super
158
- # end
159
- # end
160
-
157
+
161
158
  # compile the cloud spec and execute the compiled system and remote calls
162
159
  def run
163
160
  puts " running on #{cloud_provider.class}"
@@ -174,7 +171,7 @@ log_level :info
174
171
  # security_groups, triggers and instances defined by this cloud
175
172
  def teardown
176
173
  raise "Only Ec2 teardown supported" unless cloud_provider.name.to_s == 'ec2'
177
- puts "!! Tearing down cloud #{name}"
174
+ puts "! Tearing down cloud #{name}"
178
175
  # load_balancers.each do |name, lb|
179
176
  # puts "! Deleting load_balaner #{lb_name}"
180
177
  # lb.teardown
@@ -221,6 +218,7 @@ No autoscalers defined
221
218
  end
222
219
  else
223
220
  # Terminate the nodes
221
+ @num_nodes = orig_nodes.size
224
222
  orig_nodes.each do |node|
225
223
  node.terminate!
226
224
  puts "----> Terminated node: #{node.instance_id}"
@@ -228,7 +226,7 @@ No autoscalers defined
228
226
  puts "----> Waiting for new node to boot via the autoscaler"
229
227
  loop do
230
228
  reset!
231
- break if nodes.size == num_nodes
229
+ break if nodes.size == @num_nodes
232
230
  $stdout.print "."
233
231
  $stdout.flush
234
232
  sleep 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.5
4
+ version: 1.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2009-12-02 00:00:00 -08:00
14
+ date: 2009-12-22 00:00:00 -08:00
15
15
  default_executable:
16
16
  dependencies: []
17
17