class Kitchen::Provisioner::Dummy
Dummy
provisioner for Kitchen
. This driver does nothing but report what would happen if this provisioner did anything of consequence. As a result it may be a useful provisioner to use when debugging or developing new features or plugins.
@author Fletcher Nichol <fnichol@nichol.ca>
Public Instance Methods
call(state)
click to toggle source
(see Base#call
)
# File lib/kitchen/provisioner/dummy.rb, line 37 def call(state) info("[#{name}] Converge on instance=#{instance} with state=#{state}") sleep_if_set failure_if_set debug("[#{name}] Converge completed (#{config[:sleep]}s).") end
Private Instance Methods
failure_if_set()
click to toggle source
Simulate a failure in an action, if set in the config.
@api private
# File lib/kitchen/provisioner/dummy.rb, line 56 def failure_if_set if config[:fail] debug("Failure for Provisioner #{name}.") raise ActionFailed, "Action #converge failed for #{instance.to_str}." elsif config[:random_failure] && randomly_fail? debug("Random failure for Provisioner #{name}.") raise ActionFailed, "Action #converge failed for #{instance.to_str}." end end
randomly_fail?()
click to toggle source
Determine whether or not to randomly fail.
@return [true, false] @api private
# File lib/kitchen/provisioner/dummy.rb, line 70 def randomly_fail? [true, false].sample end
sleep_if_set()
click to toggle source
Sleep for a period of time, if a value is set in the config.
@api private
# File lib/kitchen/provisioner/dummy.rb, line 49 def sleep_if_set sleep(config[:sleep].to_f) if config[:sleep].to_f > 0.0 end