Adding state check interval to start_instance

This commit is contained in:
Ted Wexler 2015-08-12 11:35:48 +02:00
parent 7e0050fad3
commit 2a51e3770d
5 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,7 @@
# 0.6.1
* Added configurable instance state check interval
# 0.6.0 (December 13, 2014)
* Support static Elastic IP addresses.

View File

@ -108,6 +108,8 @@ This provider exposes quite a few provider-specific configuration options:
the instance. If nil, it will use the default set by Amazon.
* `instance_ready_timeout` - The number of seconds to wait for the instance
to become "ready" in AWS. Defaults to 120 seconds.
* `instance_check_interval` - The number of seconds to wait to check the instance's
state
* `instance_package_timeout` - The number of seconds to wait for the instance
to be burnt into an AMI during packaging. Defaults to 600 seconds.
* `instance_type` - The type of instance, such as "m3.medium". The default

View File

@ -32,7 +32,7 @@ module VagrantPlugins
# Wait for the instance to be ready first
env[:metrics]["instance_ready_time"] = Util::Timer.time do
tries = region_config.instance_ready_timeout / 2
tries = region_config.instance_ready_timeout / region_config.instance_check_interval
env[:ui].info(I18n.t("vagrant_aws.waiting_for_ready"))
begin
@ -41,7 +41,7 @@ module VagrantPlugins
next if env[:interrupted]
# Wait for the server to be ready
server.wait_for(2) { ready? }
server.wait_for(region_config.instance_check_interval) { ready? }
end
rescue Fog::Errors::TimeoutError
# Notify the user

View File

@ -24,6 +24,11 @@ module VagrantPlugins
# @return [Fixnum]
attr_accessor :instance_ready_timeout
# The interval to wait for checking an instance's state.
#
# @return [Fixnum]
attr_accessor :instance_check_interval
# The timeout to wait for an instance to successfully burn into an AMI.
#
# @return [Fixnum]
@ -170,6 +175,7 @@ module VagrantPlugins
@access_key_id = UNSET_VALUE
@ami = UNSET_VALUE
@availability_zone = UNSET_VALUE
@instance_check_interval = UNSET_VALUE
@instance_ready_timeout = UNSET_VALUE
@instance_package_timeout = UNSET_VALUE
@instance_type = UNSET_VALUE
@ -293,6 +299,9 @@ module VagrantPlugins
# Set the default timeout for waiting for an instance to be ready
@instance_ready_timeout = 120 if @instance_ready_timeout == UNSET_VALUE
# Set the default interval to check instance state
@instance_check_interval = 2 if @instance_check_interval == UNSET_VALUE
# Set the default timeout for waiting for an instance to burn into and ami
@instance_package_timeout = 600 if @instance_package_timeout == UNSET_VALUE

View File

@ -20,6 +20,7 @@ describe VagrantPlugins::AWS::Config do
its("ami") { should be_nil }
its("availability_zone") { should be_nil }
its("instance_ready_timeout") { should == 120 }
its("instance_check_interval") { should == 2 }
its("instance_package_timeout") { should == 600 }
its("instance_type") { should == "m3.medium" }
its("keypair_name") { should be_nil }