Skip to content

Commit

Permalink
Added minimum_instances checks to cloud-contract
Browse files Browse the repository at this point in the history
  • Loading branch information
avishai committed Jan 4, 2010
1 parent 4ff8148 commit 890975f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/cloud-contract
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ EOS
node_to_terminate = cld.nodes.last
# node_to_terminate.cloud = cld

puts cld.nodes.size
if cld.nodes.size - 1 < cld.minimum_instances
puts "Contracting instances by 1 in cloud #{cld.name} will lower the number of instances below specified minimum (#{cld.minimum_instances})"
next
end
msg = [
"Contracting cloud #{cld.name} (#{cld.keypair}) by 1",
"#{cld.nodes.size} running instances (#{cld.minimum_instances} - #{cld.maximum_instances})",
Expand All @@ -32,4 +37,4 @@ EOS
puts "#{node_to_terminate.public_ip} has been terminated"
end
end
end
end

0 comments on commit 890975f

Please sign in to comment.