Class: Kitchen::Plugin::Base
- Inherits:
-
Object
- Object
- Kitchen::Plugin::Base
- Defined in:
- lib/kitchen/plugin_base.rb
Direct Known Subclasses
Driver::Base, Driver::SSHBase, Kitchen::Provisioner::Base, Transport::Base, Verifier::Base
Class Attribute Summary collapse
-
.serial_actions ⇒ Array<Symbol>
readonly
An array of action method names that cannot be run concurrently and must be run in serial via a shared mutex.
Class Method Summary collapse
-
.no_parallel_for(*methods) ⇒ Object
Registers certain driver actions that cannot be safely run concurrently in threads across multiple instances.
Class Attribute Details
.serial_actions ⇒ Array<Symbol> (readonly)
Returns an array of action method names that cannot be run concurrently and must be run in serial via a shared mutex.
24 25 26 |
# File 'lib/kitchen/plugin_base.rb', line 24 def serial_actions @serial_actions end |
Class Method Details
.no_parallel_for(*methods) ⇒ Object
Registers certain driver actions that cannot be safely run concurrently in threads across multiple instances. Typically this might be used for create or destroy actions that use an underlying resource that cannot be used at the same time.
A shared mutex for this driver object will be used to synchronize all registered methods.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kitchen/plugin_base.rb', line 45 def self.no_parallel_for(*methods) action_methods = %i{create setup converge verify destroy} Array(methods).each do |meth| next if action_methods.include?(meth) raise ClientError, "##{meth} is not a valid no_parallel_for method" end @serial_actions ||= [] @serial_actions += methods end |