Previously (current HEAD) you could instantiate many spot requests by using instance_count, but only the first was added to the SpotRequests collection and returned.
This pull request updates Fog::Compute::AWS::SpotRequest#save so that it initializes and adds all newly created spot requests to the Fog::Compute::AWS::SpotRequests collection. If instance_count is 1 (which is the default) it returns the generated spot_request. If instance_count is greater than 1 it will return an array of the newly created spot requests.
(Please note: this does not change the result of spot_requests.create because Fog::Collection#create automatically returns the object created when SpotRequest.new is called (not the result of SpotRequest#save).
This pull request also updates Fog::Compute::AWS::SpotRequests#bootstrap to allow it to bootstrap multiple servers at once if instance_count is more than one. Fog::Compute::AWS::SpotRequests#bootstrap will then return an array of Fog::Compute::AWS::Server objects (when instance_count == 1) or it will return the first Fog::Compute::AWS::Server (when instance_count == 1).
I do not see any tests specific to Fog::Compute::AWS::SpotRequests or Fog::Compute::AWS::SpotRequest, but I certainly can try to add some testing with a bit of direction.
In the default case of instance_count == 1 both Fog::Compute::AWS::SpotRequests#bootstrap and Fog::Compute::AWS::SpotRequest#save return the same value as current HEAD.
Update SpotRequest#save to create additional collection entries with …
…instance_count > 1.
Make SpotRequests#bootstrap handle instance_count > 1.
Simplify iteration in SpotRequest#save.
Reload spot_request before getting instance_id.
@rjackson thanks for this. I think we should add some more testing as well though. Probably should go in fog/tests/aws/models/compute. Not sure how/why we ended up in a state where there don't appear to be any tests for spot stuff, but if you could add some there that would be awesome. Thanks!
Merge branch 'master' of git://github.com/fog/fog into handle_multipl…
@rjackson - sorry this got misplaced. Anything we should still do related to this? Thanks!