Ravn::Tactical::Operation::

Test class

Ravn-tactical Operation for testing the task queue.

Public Class Methods

new( fail: false, result: 'array' )

Overridden to specify the valid config options.

   # File lib/ravn/tactical/operation/test.rb
22 def initialize( fail: false, result: 'array' )
23     super
24 end
param_validator()

Return a block for Roda::RodaPlugins::TypecastParams validation for this operation.

   # File lib/ravn/tactical/operation/test.rb
13 def self::param_validator
14     return ->( params ) do
15         params.bool( 'fail', false )
16         params.nonempty_str( 'result' )
17     end
18 end

Public Instance Methods

after_run( node, response )

Do post-proceessing/teardown after the run.

   # File lib/ravn/tactical/operation/test.rb
48 def after_run( node, response )
49     self.log.info "Response from %p was: %p" % [ node, response ]
50     return super
51 end
before_run( node )

Do any preparation before the run.

   # File lib/ravn/tactical/operation/test.rb
28 def before_run( node )
29     self.log.info "Testing operations on %p" % [ node ]
30     super
31 end
run( * )

Either echo stuff back in the log, or raise if the fail option is set.

   # File lib/ravn/tactical/operation/test.rb
35 def run( * )
36     self.log.info "Running the `test' operation."
37     raise "Failed!" if self.config[ :fail ]
38 
39     if self.config[ :result ] == 'object'
40         return { result: 'Success.' }
41     else
42         return [ 'Success.' ]
43     end
44 end