Class: Kitchen::Driver::Static::Queueing::Script

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/driver/queueing/script.rb

Instance Attribute Summary

Attributes inherited from Base

#banner, #env_vars, #options, #release_options, #request_options

Instance Method Summary collapse

Methods inherited from Base

#banner?, descendants, #initialize, #release, #request

Constructor Details

This class inherits a constructor from Kitchen::Driver::Static::Queueing::Base

Instance Method Details

#handle_release(_state) ⇒ Object



30
31
32
# File 'lib/kitchen/driver/queueing/script.rb', line 30

def handle_release(_state)
  execute(release_options[:execute])
end

#handle_request(_state) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kitchen/driver/queueing/script.rb', line 18

def handle_request(_state)
  stdout = execute(request_options[:execute])

  matched = stdout.match(request_options[:match_hostname])
  raise format("Could not extract hostname from '%s' with regular expression /%s/", stdout, request_options[:match_hostname]) unless matched

  # Allow additional feedback from command
  @banner = stdout.match(request_options[:match_banner])&.captures&.first if request_options[:match_banner]

  matched.captures.first
end

#setup(_kitchen_options) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/kitchen/driver/queueing/script.rb', line 9

def setup(_kitchen_options)
  default_request_options({
    match_hostname: "^(.*)$",
    match_banner: nil,
  })

  default_release_options({})
end