Class: Armada::Host
- Inherits:
-
Object
- Object
- Armada::Host
- Defined in:
- lib/armada/docker/host.rb
Instance Attribute Summary collapse
-
#docker_connection ⇒ Object
readonly
Returns the value of attribute docker_connection.
Class Method Summary collapse
Instance Method Summary collapse
- #connection ⇒ Object
- #get_all_containers ⇒ Object
- #get_all_images ⇒ Object
- #get_container(id) ⇒ Object
- #get_image(name, tag, options = {}) ⇒ Object
- #get_image_by_id(id, options) ⇒ Object
- #host ⇒ Object
-
#initialize(docker_connection) ⇒ Host
constructor
A new instance of Host.
- #port ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(docker_connection) ⇒ Host
Returns a new instance of Host.
4 5 6 |
# File 'lib/armada/docker/host.rb', line 4 def initialize(docker_connection) @docker_connection = docker_connection end |
Instance Attribute Details
#docker_connection ⇒ Object (readonly)
Returns the value of attribute docker_connection.
3 4 5 |
# File 'lib/armada/docker/host.rb', line 3 def docker_connection @docker_connection end |
Class Method Details
Instance Method Details
#connection ⇒ Object
48 49 50 |
# File 'lib/armada/docker/host.rb', line 48 def connection @docker_connection.connection end |
#get_all_containers ⇒ Object
36 37 38 |
# File 'lib/armada/docker/host.rb', line 36 def get_all_containers ::Docker::Container.all({:all => true}, connection) end |
#get_all_images ⇒ Object
32 33 34 |
# File 'lib/armada/docker/host.rb', line 32 def get_all_images ::Docker::Image.all({:all => true}, connection) end |
#get_container(id) ⇒ Object
40 41 42 43 44 45 46 |
# 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 = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/armada/docker/host.rb', line 8 def get_image(name, tag, = {}) begin image = ::Docker::Image.get("#{name}:#{tag}", {}, connection) [:docker_image] = image [:id] = image.id if image rescue Exception => e Armada.ui.warn "#{host} -- #{e.}" ensure return Image.new(self, ) end end |
#get_image_by_id(id, options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/armada/docker/host.rb', line 20 def get_image_by_id(id, ) begin image = ::Docker::Image.get(id, {}, connection) [:docker_image] = image [:id] = id rescue Exception => e Armada.ui.warn "#{host} -- #{e.}" ensure return Image.new(self, ) end end |
#host ⇒ Object
52 53 54 |
# File 'lib/armada/docker/host.rb', line 52 def host @docker_connection.host end |
#port ⇒ Object
56 57 58 |
# File 'lib/armada/docker/host.rb', line 56 def port @docker_connection.port end |
#to_s ⇒ Object
60 61 62 |
# File 'lib/armada/docker/host.rb', line 60 def to_s "#{host}:#{port} -- #{connection}" end |