mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #2069 from icco/random-bugs
[google|compute] Fix some issues with GCE examples and disk requests.
This commit is contained in:
commit
56785dbfb5
6 changed files with 23 additions and 9 deletions
|
@ -2,17 +2,19 @@ def test
|
|||
|
||||
connection = Fog::Compute.new({ :provider => "Google" })
|
||||
|
||||
# puts 'Listing images in all projects...'
|
||||
# puts 'Listing snapshots...'
|
||||
# puts '---------------------------------'
|
||||
snapshots = connection.snapshots.all
|
||||
raise 'Could not LIST the snapshots' unless snapshots
|
||||
# puts snapshots.inspect
|
||||
|
||||
snap = snapshots.first
|
||||
# puts 'Fetching a single image from a global project...'
|
||||
# puts 'Fetching a single snapshot...'
|
||||
# puts '------------------------------------------------'
|
||||
snap = connection.snapshots.get(snap)
|
||||
raise 'Could not GET the snapshot' unless snap
|
||||
# puts snap.inspect
|
||||
snap = snapshots.first
|
||||
if !snap.nil?
|
||||
snap = connection.snapshots.get(snap)
|
||||
raise 'Could not GET the snapshot' unless snap
|
||||
# puts snap.inspect
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ def test
|
|||
:name => 'foggydisk',
|
||||
:size_gb => 10,
|
||||
:zone_name => 'us-central1-a',
|
||||
:image_name => 'centos-6-v20130522',
|
||||
:source_image => 'centos-6-v20130522',
|
||||
})
|
||||
|
||||
disk.wait_for { disk.ready? }
|
||||
|
|
|
@ -2,9 +2,9 @@ def test
|
|||
connection = Fog::Compute.new({ :provider => "Google" })
|
||||
|
||||
# we create a new private network
|
||||
connection.insert_network('my-private-network','10.240.0.0/16')
|
||||
connection.insert_network('my-private-network', '10.240.0.0/16')
|
||||
|
||||
server = connection.servers.bootstrap(defaults = {
|
||||
server = connection.servers.create({
|
||||
:name => "fog-smoke-test-#{Time.now.to_i}",
|
||||
:image_name => "debian-7-wheezy-v20130522",
|
||||
:machine_type => "n1-standard-1",
|
||||
|
@ -15,4 +15,7 @@ def test
|
|||
:external_ip => false,
|
||||
:user => ENV['USER'],
|
||||
})
|
||||
|
||||
# The network won't have any firewall rules, so we won't be able to ssh in.
|
||||
server.wait_for { ready? }
|
||||
end
|
||||
|
|
|
@ -13,6 +13,10 @@ module Fog
|
|||
class Real
|
||||
|
||||
def delete_disk(disk_name, zone_name)
|
||||
if zone_name.start_with? 'http'
|
||||
zone_name = zone_name.split('/')[-1]
|
||||
end
|
||||
|
||||
api_method = @compute.disks.delete
|
||||
parameters = {
|
||||
'project' => @project,
|
||||
|
|
|
@ -16,6 +16,7 @@ module Fog
|
|||
if zone_name.start_with? 'http'
|
||||
zone_name = zone_name.split('/')[-1]
|
||||
end
|
||||
|
||||
api_method = @compute.disks.get
|
||||
parameters = {
|
||||
'project' => @project,
|
||||
|
|
|
@ -13,6 +13,10 @@ module Fog
|
|||
class Real
|
||||
|
||||
def get_snapshot(snap_name, project=@project)
|
||||
if snap_name.nil?
|
||||
raise ArgumentError.new "snap_name must not be nil."
|
||||
end
|
||||
|
||||
api_method = @compute.snapshots.get
|
||||
parameters = {
|
||||
'snapshot' => snap_name,
|
||||
|
|
Loading…
Reference in a new issue