Sha256: 94ec20ed8305232dfb92809a6676213dcdd17dd7b2dfa63b7e51227d5eb89709

Contents?: true

Size: 1018 Bytes

Versions: 5

Compression:

Stored size: 1018 Bytes

Contents

def test
  connection = Fog::Compute.new({ :provider => "Google" })

  # puts 'Listing images in all projects...'
  # puts '---------------------------------'
  images = connection.images.all
  raise 'Could not LIST the images' unless images
  # puts images.inspect

  # puts 'Fetching a single image from a global project...'
  # puts '------------------------------------------------'
  img = connection.images.get('debian-6-squeeze-v20130515')
  raise 'Could not GET the image' unless img
  # puts img.inspect

  # First, get the name of an image that is in the users 'project' (not global)
  custom_img_name = images.detect { |img| img.project == img.service.project }
  # Run the next test only if there is a custom image available
  if custom_img_name
    # puts 'Fetching a single image from the custom project'
    # puts '----------------------------------------------'
    img = connection.images.get(custom_img_name)
    raise 'Could not GET the (custom) image' unless img
    # puts img.inspect
  end

end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
fog-1.16.0 lib/fog/google/examples/get_list_images.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/google/examples/get_list_images.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/google/examples/get_list_images.rb
fog-1.15.0 lib/fog/google/examples/get_list_images.rb
gapinc-fog-1.14.0 lib/fog/google/examples/get_list_images.rb