Class: Kitchen::Transport::Lxd
- Inherits:
-
Base
- Object
- Base
- Kitchen::Transport::Lxd
- Defined in:
- lib/kitchen/transport/lxd.rb
Defined Under Namespace
Classes: Connection
Instance Method Summary collapse
- #connection(state) ⇒ Object
-
#initialize(config = {}) ⇒ Lxd
constructor
A new instance of Lxd.
- #nx_transport(state) ⇒ Object
- #state_filename ⇒ Object
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_filename ⇒ Object
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 |