Method: CloudFlock::Target::Servers::Platform#initialize

Defined in:
lib/cloudflock/target/servers/platform.rb

#initialize(cpe, fog = nil) ⇒ Platform

Public: Initialize the Platform object.

cpe - CPE object to use in determining image ID. fog - Fog Compute object used to obtain flavor and image maps.

(default: nil)

Raises ArgumentError if anything but a CPE object is passed. Raises KeyError if the CPE object doesn’t have vendor and version defined.



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cloudflock/target/servers/platform.rb', line 26

def initialize(cpe, fog = nil)
  unless cpe.is_a?(CPE)
    raise(ArgumentError, Errstr::NOT_CPE)
  end
  if cpe.vendor.nil? or cpe.version.nil?
    raise(KeyError, Errstr::CPE_INCOMPLETE)
  end

  @cpe = cpe
  build_maps(fog)
end