diff --git a/lib/fog/google/examples/get_list_snapshots.rb b/lib/fog/google/examples/get_list_snapshots.rb index fbfb15b98..91f265186 100644 --- a/lib/fog/google/examples/get_list_snapshots.rb +++ b/lib/fog/google/examples/get_list_snapshots.rb @@ -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 diff --git a/lib/fog/google/examples/launch_micro_instance.rb b/lib/fog/google/examples/launch_micro_instance.rb index 56f5fcad3..c59e7e797 100755 --- a/lib/fog/google/examples/launch_micro_instance.rb +++ b/lib/fog/google/examples/launch_micro_instance.rb @@ -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? } diff --git a/lib/fog/google/examples/network.rb b/lib/fog/google/examples/network.rb index b7ad0c379..751795000 100644 --- a/lib/fog/google/examples/network.rb +++ b/lib/fog/google/examples/network.rb @@ -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 diff --git a/lib/fog/google/requests/compute/delete_disk.rb b/lib/fog/google/requests/compute/delete_disk.rb index e673ab4c1..e7903d5e7 100644 --- a/lib/fog/google/requests/compute/delete_disk.rb +++ b/lib/fog/google/requests/compute/delete_disk.rb @@ -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, diff --git a/lib/fog/google/requests/compute/get_disk.rb b/lib/fog/google/requests/compute/get_disk.rb index 2349f561a..5914c3ffd 100644 --- a/lib/fog/google/requests/compute/get_disk.rb +++ b/lib/fog/google/requests/compute/get_disk.rb @@ -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, diff --git a/lib/fog/google/requests/compute/get_snapshot.rb b/lib/fog/google/requests/compute/get_snapshot.rb index 1dc66282e..1b3a2ba9d 100644 --- a/lib/fog/google/requests/compute/get_snapshot.rb +++ b/lib/fog/google/requests/compute/get_snapshot.rb @@ -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,