Class: Kitchen::Driver::Base
- Inherits:
-
Object
- Object
- Kitchen::Driver::Base
- Defined in:
- lib/kitchen/driver/base.rb
Overview
Base class for a driver.
Class Attribute Summary collapse
-
.serial_actions ⇒ Object
readonly
Returns the value of attribute serial_actions.
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#[](attr) ⇒ Object
Provides hash-like access to configuration keys.
-
#config_keys ⇒ Array
Returns an array of configuration keys.
-
#converge(state) ⇒ Object
Converges a running instance.
-
#create(state) ⇒ Object
Creates an instance.
-
#destroy(state) ⇒ Object
Destroys an instance.
-
#diagnose ⇒ Hash
Returns a Hash of configuration and other useful diagnostic information.
-
#initialize(config = {}) ⇒ Base
constructor
A new instance of Base.
-
#login_command(state) ⇒ LoginCommand
Returns the shell command that will log into an instance.
-
#name ⇒ String
Returns the name of this driver, suitable for display in a CLI.
-
#setup(state) ⇒ Object
Sets up an instance.
- #validate_config! ⇒ Object
-
#verify(state) ⇒ Object
Verifies a converged instance.
-
#verify_dependencies ⇒ Object
Performs whatever tests that may be required to ensure that this driver will be able to function in the current environment.
Constructor Details
Class Attribute Details
.serial_actions ⇒ Object (readonly)
Returns the value of attribute serial_actions.
38 39 40 |
# File 'lib/kitchen/driver/base.rb', line 38 def serial_actions @serial_actions end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
35 36 37 |
# File 'lib/kitchen/driver/base.rb', line 35 def instance @instance end |
Instance Method Details
#[](attr) ⇒ Object
Provides hash-like access to configuration keys.
65 66 67 |
# File 'lib/kitchen/driver/base.rb', line 65 def [](attr) config[attr] end |
#config_keys ⇒ Array
Returns an array of configuration keys.
72 73 74 |
# File 'lib/kitchen/driver/base.rb', line 72 def config_keys config.keys end |
#converge(state) ⇒ Object
Converges a running instance.
86 |
# File 'lib/kitchen/driver/base.rb', line 86 def converge(state) ; end |
#create(state) ⇒ Object
Creates an instance.
80 |
# File 'lib/kitchen/driver/base.rb', line 80 def create(state) ; end |
#destroy(state) ⇒ Object
Destroys an instance.
104 |
# File 'lib/kitchen/driver/base.rb', line 104 def destroy(state) ; end |
#diagnose ⇒ Hash
Returns a Hash of configuration and other useful diagnostic information.
128 129 130 131 132 |
# File 'lib/kitchen/driver/base.rb', line 128 def diagnose result = Hash.new config_keys.sort.each { |k| result[k] = config[k] } result end |
#login_command(state) ⇒ LoginCommand
Returns the shell command that will log into an instance.
112 113 114 |
# File 'lib/kitchen/driver/base.rb', line 112 def login_command(state) raise ActionFailed, "Remote login is not supported in this driver." end |
#name ⇒ String
Returns the name of this driver, suitable for display in a CLI.
57 58 59 |
# File 'lib/kitchen/driver/base.rb', line 57 def name self.class.name.split('::').last end |
#setup(state) ⇒ Object
Sets up an instance.
92 |
# File 'lib/kitchen/driver/base.rb', line 92 def setup(state) ; end |
#validate_config! ⇒ Object
48 49 50 51 52 |
# File 'lib/kitchen/driver/base.rb', line 48 def validate_config! Array(self.class.validations).each do |tuple| tuple.last.call(tuple.first, config[tuple.first], self) end end |
#verify(state) ⇒ Object
Verifies a converged instance.
98 |
# File 'lib/kitchen/driver/base.rb', line 98 def verify(state) ; end |
#verify_dependencies ⇒ Object
Performs whatever tests that may be required to ensure that this driver will be able to function in the current environment. This may involve checking for the presence of certain directories, software installed, etc.
123 |
# File 'lib/kitchen/driver/base.rb', line 123 def verify_dependencies ; end |