class Kitchen::Driver::Static::Queueing::Script
Public Instance Methods
handle_release(_state)
click to toggle source
# File lib/kitchen/driver/queueing/script.rb, line 30 def handle_release(_state) execute(release_options[:execute]) end
handle_request(_state)
click to toggle source
# 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)
click to toggle source
# 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
Private Instance Methods
execute(command)
click to toggle source
# File lib/kitchen/driver/queueing/script.rb, line 36 def execute(command) raise format("Received empty command") if command.nil? || command.empty? cmd = Mixlib::ShellOut.new(command, environment: env_vars, timeout: timeout) cmd.run_command raise format("Error executing `%s`: %s", command, cmd.stderr) if cmd.status != 0 cmd.stdout.strip end