Class: Kitchen::Transport::Base
- Inherits:
-
Plugin::Base
- Object
- Plugin::Base
- Kitchen::Transport::Base
- Includes:
- Configurable, Logging
- Defined in:
- lib/kitchen/transport/base.rb
Overview
Base class for a transport.
Defined Under Namespace
Classes: Connection
Instance Attribute Summary
Attributes included from Configurable
Class Method Summary collapse
-
.kitchen_transport_api_version(version) ⇒ Object
Sets the API version for this transport.
Instance Method Summary collapse
-
#cleanup! ⇒ void
Closes the connection, if it is still active.
-
#connection(state) ⇒ Connection
Creates a new Connection, configured by a merging of configuration and state data.
-
#doctor(state) ⇒ Object
Check system and configuration for common errors.
-
#initialize(config = {}) ⇒ Base
constructor
Create a new transport by providing a configuration hash.
Methods included from Logging
#banner, #debug, #error, #fatal, #info, #warn
Methods included from Configurable
#[], #bourne_shell?, #calculate_path, #config_keys, #diagnose, #diagnose_plugin, #finalize_config!, included, #name, #powershell_shell?, #remote_path_join, #unix_os?, #verify_dependencies, #windows_os?
Methods inherited from Plugin::Base
Constructor Details
#initialize(config = {}) ⇒ Base
Create a new transport by providing a configuration hash.
51 52 53 54 |
# File 'lib/kitchen/transport/base.rb', line 51 def initialize(config = {}) @connection = nil init_config(config) end |
Class Method Details
.kitchen_transport_api_version(version) ⇒ Object
Sets the API version for this transport. If the transport does not set this value, then ‘nil` will be used and reported.
Sets the API version for this transport
231 232 233 |
# File 'lib/kitchen/transport/base.rb', line 231 def self.kitchen_transport_api_version(version) @api_version = version end |
Instance Method Details
#cleanup! ⇒ void
This method returns an undefined value.
Closes the connection, if it is still active.
80 81 82 |
# File 'lib/kitchen/transport/base.rb', line 80 def cleanup! # This method may be left unimplemented if that is applicable end |
#connection(state) ⇒ Connection
Creates a new Connection, configured by a merging of configuration and state data. Depending on the implementation, the Connection could be saved or cached to speed up multiple calls, given the same state hash as input.
rubocop:disable Lint/UnusedMethodArgument
65 66 67 |
# File 'lib/kitchen/transport/base.rb', line 65 def connection(state) raise ClientError, "#{self.class}#connection must be implemented" end |
#doctor(state) ⇒ Object
Check system and configuration for common errors.
73 74 75 |
# File 'lib/kitchen/transport/base.rb', line 73 def doctor(state) false end |