Skip to content

Commit

Permalink
Wait choice option added for Spot Instance request fulfillment.
Browse files Browse the repository at this point in the history
  • Loading branch information
aliasgar16 authored and aliasgar16 committed Jul 23, 2015
1 parent dd84472 commit 766582c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/chef/knife/ec2_server_create.rb
Expand Up @@ -400,9 +400,20 @@ def run
msg_pair("Spot Request ID", spot_request.id)
msg_pair("Spot Request Type", spot_request.request_type)
msg_pair("Spot Price", spot_request.price)
#puts "Spot Req ID :: #{spot_request.id}"
#puts "Spot Req Type :: #{spot_request.request_type}"
#puts "Spot Price :: #{spot_request.price}"

puts 'Do you want to wait for Spot Instance Request fulfillment? (Y/N) '
user_choice = STDIN.gets.chomp
if user_choice.casecmp('y') == 0
print ui.color("You decided to wait.\n", :cyan)
elsif user_choice.casecmp('n') == 0
print ui.color("You decided not to wait.\n", :cyan)
print ui.color("Hence, putting current execution in background.\n", :cyan)
Process.kill("SIGTSTP", Process.pid)
else
print ui.color("Invalid input\n", :red)
exit 1
end

print ui.color("Waiting for Spot Request fulfillment: ", :cyan)
spot_request.wait_for do
@spinner ||= %w{| / - \\}
Expand Down

0 comments on commit 766582c

Please sign in to comment.