Sha256: 116c0562a0ef6507f8a5f68e86314a11a3840e5b2f864a43d33e53a17ea43191

Contents?: true

Size: 1.63 KB

Versions: 28

Compression:

Stored size: 1.63 KB

Contents

require "#{::File.dirname(__FILE__)}/vmware"

module CloudProviders

  class VmwareInstance < CloudProviderInstance
    
    default_options(
      :launching_time   => nil,
      :vmx_file         => nil,
      :instance_id      => nil,
      :public_ip        => nil,
      :status           => "running",
      :dns_name         => nil
    )
    
    # A new instance will be created from a hash.
    # The parent clouds describe_instances list will be searched for the first one matching any of this instance's provided unique identifiers.
    # If an instance is found, this instance's properties will be set to the properties provided
    # If the found instance has properties of the same key as the provided options, the found instance's values will override the passed in options
    def initialize(opts={}, &block)
      set_vars_from_options(opts)
      super
    end
    
    # Printing. This is how we extract the instances into the listing on the 
    # local side into the local listing file
    def to_s
      "#{name}\t#{dns_name}\t#{instance_id}"
    end
    
    def status
      "running"
    end
    
    # Since we aren't actually getting any ips from a list, only using 
    # the one vmx file, we don't actually need to refresh anything
    def wait_for_public_ip(timeout=60)
      public_ip      
    end
    
    def refresh!
      self
    end
    
    def cloud_provider(o={}, &block)
      @cloud_provider ||= if cloud
        cloud.cloud_provider
      else        
        options_for_cloud_provider = o.choose{|k,v| Vmware.default_options.has_key?(k)}
        Vmware.new( options_for_cloud_provider, &block)
      end
    end
    
  end

end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
poolparty-1.3.14 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.13 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.8 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.7 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.6 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.4 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.3 lib/cloud_providers/vmware/vmware_instance.rb
poolparty-1.3.1 lib/cloud_providers/vmware/vmware_instance.rb