Sha256: 55ef270741f85c9bd5e39a4d0edbff43b93d756117539fafe1a6eb9bdd89f484

Contents?: true

Size: 1.65 KB

Versions: 13

Compression:

Stored size: 1.65 KB

Contents

module ChefMetal
  #
  # Specification for a image. Sufficient information to find and contact it
  # after it has been set up.
  #
  class ImageSpec
    def initialize(image_data)
      @image_data = image_data
    end

    attr_reader :image_data

    #
    # Globally unique identifier for this image. Does not depend on the image's
    # location or existence.
    #
    def id
      raise "id unimplemented"
    end

    #
    # Name of the image. Corresponds to the name in "image 'name' do" ...
    #
    def name
      image_data['id']
    end

    #
    # Location of this image. This should be a freeform hash, with enough
    # information for the driver to look it up and create a image object to
    # access it.
    #
    # This MUST include a 'driver_url' attribute with the driver's URL in it.
    #
    # chef-metal will do its darnedest to not lose this information.
    #
    def location
      image_data['location']
    end

    #
    # Set the location for this image.
    #
    def location=(value)
      image_data['location'] = value
    end

    def machine_options
      image_data['machine_options']
    end

    def machine_options=(value)
      image_data['machine_options'] = value
    end

    # URL to the driver.  Convenience for location['driver_url']
    def driver_url
      location ? location['driver_url'] : nil
    end

    #
    # Save this image_data to the server.  If you have significant information that
    # could be lost, you should do this as quickly as possible.  image_data will be
    # saved automatically for you after allocate_image and ready_image.
    #
    def save(action_handler)
      raise "save unimplemented"
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
clc-fork-chef-metal-0.14.alpha.10 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.9 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.8 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.7 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.6 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.5 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.4 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.3 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.2 lib/chef_metal/image_spec.rb
chef-metal-0.14.2 lib/chef_metal/image_spec.rb
clc-fork-chef-metal-0.14.alpha.1 lib/chef_metal/image_spec.rb
chef-metal-0.14.1 lib/chef_metal/image_spec.rb
chef-metal-0.14 lib/chef_metal/image_spec.rb