mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2057 from icco/fix_image_test
[google|compute] Fix insert disk to deal with changes to insert image.
This commit is contained in:
commit
814ff59e76
2 changed files with 19 additions and 7 deletions
|
@ -1,16 +1,21 @@
|
|||
def test
|
||||
connection = Fog::Compute.new({ :provider => "Google" })
|
||||
time = Time.now.utc.to_i
|
||||
disk = connection.disks.create({:name => 'foggydisk', :size_gb => 10, :zone_name => 'us-central1-a', :image_name => 'centos-6-v20130522'})
|
||||
disk = connection.disks.create({
|
||||
:name => 'foggydisk',
|
||||
:size_gb => 10,
|
||||
:zone_name => 'us-central1-a',
|
||||
:image_name => 'centos-6-v20130522',
|
||||
})
|
||||
|
||||
disk.wait_for { disk.ready? }
|
||||
params = {
|
||||
:name => "fog-smoke-test-#{Time.now.to_i}",
|
||||
:machine_type => "f1-micro",
|
||||
:zone_name => "us-central1-a",
|
||||
:disks => [ disk.get_as_boot_disk(true) ],
|
||||
:kernel => 'gce-v20130522',
|
||||
:user => ENV['USER']
|
||||
:zone_name => "us-central1-a",
|
||||
:disks => [ disk.get_as_boot_disk(true) ],
|
||||
:user => ENV['USER'],
|
||||
:kernel => 'gce-v20130522',
|
||||
}
|
||||
|
||||
server = connection.servers.bootstrap params
|
||||
|
|
|
@ -18,12 +18,19 @@ module Fog
|
|||
'project' => @project,
|
||||
'zone' => zone_name
|
||||
}
|
||||
|
||||
if image_name
|
||||
# We don't know the owner of the image.
|
||||
image = images.create({:name => image_name})
|
||||
begin
|
||||
image = images.get(image_name)
|
||||
rescue Fog::Errors::Error
|
||||
# We don't know the owner of the image.
|
||||
image = images.create({:name => image_name})
|
||||
end
|
||||
|
||||
@image_url = @api_url + image.resource_url
|
||||
parameters['sourceImage'] = @image_url
|
||||
end
|
||||
|
||||
body_object = {
|
||||
'name' => disk_name,
|
||||
'sizeGb' => disk_size,
|
||||
|
|
Loading…
Reference in a new issue