From 890975fd1064ba3f3a842089213a8903d3455a2f Mon Sep 17 00:00:00 2001 From: avishai Date: Mon, 4 Jan 2010 09:21:57 +0200 Subject: [PATCH] Added minimum_instances checks to cloud-contract --- bin/cloud-contract | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/cloud-contract b/bin/cloud-contract index d586a381a..426e09591 100755 --- a/bin/cloud-contract +++ b/bin/cloud-contract @@ -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})", @@ -32,4 +37,4 @@ EOS puts "#{node_to_terminate.public_ip} has been terminated" end end -end \ No newline at end of file +end