Class/Module Index [+]

Quicksearch

Fog::Compute::GoGrid::Server

Public Class Methods

new(attributes={}) click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 23
def initialize(attributes={})
  image_id ||= 'ubuntu_10_04_LTS_64_base' # Ubuntu 10.04 LTS 64bit
  super
end

Public Instance Methods

destroy() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 28
def destroy
  requires :id
  service.grid_server_delete(id)
  true
end
image() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 34
def image
  requires :image_id
  service.grid_image_get(:image => image_id)
end
private_ip_address() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 39
def private_ip_address
  nil
end
ready?() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 43
def ready?
  @state && @state["name"] == 'On'
end
reload() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 47
def reload
  requires :name
  begin
    if data = collection.get(name)
      new_attributes = data.attributes
      merge_attributes(new_attributes)
      self
    end
  rescue Excon::Errors::BadRequest
    false
  end
end
save() click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 60
def save
  raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
  requires :name, :image_id, :memory, :public_ip_address
  options = {
    'isSandbox'   => sandbox,
    'image'       => image_id
  }
  options = options.reject {|key, value| value.nil?}
  data = service.grid_server_add(image, public_ip_address, name, memory, options)
  merge_attributes(data.body)
  true
end
setup(credentials = {}) click to toggle source
# File lib/fog/go_grid/models/compute/server.rb, line 73
def setup(credentials = {})
  requires :identity, :public_ip_address, :public_key, :username
  Fog::SSH.new(public_ip_address, username, credentials).run([
    %{mkdir .ssh},
    %{echo "#{public_key}" >> ~/.ssh/authorized_keys},
    %{passwd -l root},
    %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json},
    %{echo "#{Fog::JSON.encode(metadata)}" >> ~/metadata.json}
  ])
rescue Errno::ECONNREFUSED
  sleep(1)
  retry
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.