File: image_create.rb

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 620 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
def test
  connection = Fog::Compute.new(:provider => "Google")

  rawdisk = {
    :source         => nil, # Google Cloud Storage URL pointing to the disk image. (e.g. http://storage.googleapis.com/test/test.tar.gz)
    :container_type => "TAR"
  }

  # Can't test this unless the 'source' points to a valid URL
  return if rawdisk[:source].nil?

  img = connection.images.create(:name             => "test-image",
                                 :description      => "Test image (via fog)",
                                 :raw_disk         => rawdisk)

  img.reload # will raise if image was not saved correctly
end