Class: Kitchen::Transport::Lxd

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/transport/lxd.rb

Defined Under Namespace

Classes: Connection

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Lxd

Returns a new instance of Lxd.



13
14
15
16
# File 'lib/kitchen/transport/lxd.rb', line 13

def initialize(config = {})
  super
  @cache = {}
end

Instance Method Details

#connection(state) ⇒ Object



18
19
20
21
22
# File 'lib/kitchen/transport/lxd.rb', line 18

def connection(state)
  begin
    @cache[state[:container_name]] ||= Connection.new nx_transport(state), config.to_hash.merge(state.merge(logger: logger)), state_filename
  end.tap { |conn| yield conn if block_given? }
end

#nx_transport(state) ⇒ Object



24
25
26
# File 'lib/kitchen/transport/lxd.rb', line 24

def nx_transport(state)
  instance.driver.nx_transport state
end

#state_filenameObject



28
29
30
# File 'lib/kitchen/transport/lxd.rb', line 28

def state_filename
  instance.instance_variable_get("@state_file").instance_variable_get("@file_name")
end