Browse files

Fix bug when instances was empty.

Add git-style-binaries to Gemfile
simplify examples/simple.rb example cloud.
  • Loading branch information...
1 parent 147cb82 commit 696906d1604edb430b1050fe10d7f16bc4156881 @fairchild fairchild committed Sep 4, 2011
Showing with 14 additions and 7 deletions.
  1. +1 −0 Gemfile
  2. +5 −0 Gemfile.lock
  3. +6 −6 examples/simple.rb
  4. +2 −1 lib/cloud_providers/ec2/ec2.rb
View
1 Gemfile
@@ -1,4 +1,5 @@
source "http://rubygems.org"
+gem 'git-style-binaries'
group :test do
gem "shoulda"
View
5 Gemfile.lock
@@ -12,19 +12,24 @@ GEM
amazon-ec2 (0.9.17)
xml-simple (>= 1.0.12)
fakeweb (1.3.0)
+ git-style-binaries (0.1.11)
+ shoulda
+ trollop
json (1.5.3)
mcmire-matchy (0.5.2)
mocha (0.9.12)
rdoc (3.9.4)
right_http_connection (1.3.0)
shoulda (2.11.3)
+ trollop (1.16.2)
xml-simple (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
fakeweb
+ git-style-binaries
mcmire-matchy
mocha
poolparty!
View
12 examples/simple.rb
@@ -8,9 +8,9 @@
cloud "simple" do
instances 1..3
using :ec2
- autoscale do
- trigger :lower_threshold => 0.3, :upper_threshold => 1.0, :measure => :cpu
- end
+ # autoscale do
+ # trigger :lower_threshold => 0.3, :upper_threshold => 1.0, :measure => :cpu
+ # end
image_id "ami-ccf615a5" #alestic jaunty
availability_zones ['us-east-1b']
#TODO: accept array of hashes defining security group rules
@@ -23,9 +23,9 @@
security_group "dummy-test-security-group" do
%w(22 80 443 8642).each {|port| authorize :from_port => port, :to_port => port}
end
- load_balancer do
- listener :external_port => 8080, :internal_port => 8080, :protocol => 'tcp'
- end
+ # load_balancer do
+ # listener :external_port => 8080, :internal_port => 8080, :protocol => 'tcp'
+ # end
end
end
View
3 lib/cloud_providers/ec2/ec2.rb
@@ -325,7 +325,8 @@ def nodes
#
# === Parameters
# instance - An ec2 instance as returned from describe_instances
- def tags instance
+ def tags(instance)
+ return [] if instance.groupSet.nil? || instance.groupSet.item.empty?
instance.groupSet.item.collect{|g| g.groupId }.select {|s| s.start_with? "#poolparty"}
end

0 comments on commit 696906d

Please sign in to comment.