class Armada::Host

Attributes

docker_connection[R]

Public Class Methods

create(host, options = {}) click to toggle source
# File lib/armada/docker/host.rb, line 64
def self.create(host, options = {})
  Host.new(Armada::Connection::Docker.new(host, options[:ssh_gateway], options[:ssh_gateway_user]))
end
new(docker_connection) click to toggle source
# File lib/armada/docker/host.rb, line 4
def initialize(docker_connection)
  @docker_connection = docker_connection
end

Public Instance Methods

connection() click to toggle source
# File lib/armada/docker/host.rb, line 48
def connection
  @docker_connection.connection
end
get_all_containers() click to toggle source
# File lib/armada/docker/host.rb, line 36
def get_all_containers
  ::Docker::Container.all({:all => true}, connection)
end
get_all_images() click to toggle source
# File lib/armada/docker/host.rb, line 32
def get_all_images
  ::Docker::Image.all({:all => true}, connection)
end
get_container(id) click to toggle source
# File lib/armada/docker/host.rb, line 40
def get_container(id)
  begin
    return ::Docker::Container.get(id, {}, connection)
  rescue Exception => e
    return nil
  end
end
get_image(name, tag, options = {}) click to toggle source
# File lib/armada/docker/host.rb, line 8
def get_image(name, tag, options = {})
  begin
    image = ::Docker::Image.get("#{name}:#{tag}", {}, connection)
    options[:docker_image] = image
    options[:id] = image.id if image
  rescue Exception => e
    Armada.ui.warn "#{host} -- #{e.message}"
  ensure
    return Image.new(self, options)
  end
end
get_image_by_id(id, options) click to toggle source
# File lib/armada/docker/host.rb, line 20
def get_image_by_id(id, options)
  begin
    image = ::Docker::Image.get(id, {}, connection)
    options[:docker_image] = image
    options[:id] = id
  rescue Exception => e
    Armada.ui.warn "#{host} -- #{e.message}"
  ensure
    return Image.new(self, options)
  end
end
host() click to toggle source
# File lib/armada/docker/host.rb, line 52
def host
  @docker_connection.host
end
port() click to toggle source
# File lib/armada/docker/host.rb, line 56
def port
  @docker_connection.port
end
to_s() click to toggle source
# File lib/armada/docker/host.rb, line 60
def to_s
  "#{host}:#{port} -- #{connection}"
end