Make commands to run all acceptance VMs actually do that.

Also, take conservative approach of halting any somehow stale VMs before building

Fixes #9642
This commit is contained in:
Andrew Cholakian 2018-05-22 18:41:15 -05:00
parent 3509199e87
commit 44e2639a91
4 changed files with 14 additions and 5 deletions

View file

@ -27,6 +27,9 @@ cleanup() {
}
trap cleanup EXIT
# Cleanup any stale VMs from old jobs first
bundle exec rake qa:vm:halt
if [[ $SELECTED_TEST_SUITE == $"redhat" ]]; then
echo "Generating the RPM, make sure you start with a clean environment before generating other packages."
rake artifact:rpm

View file

@ -40,7 +40,9 @@ namespace :qa do
puts user_feedback_string_for("bootstrapping", args[:platform], machines, {"experimental" => experimental})
options = {:debug => ENV['LS_QA_DEBUG']}
puts "Destroying #{machines}"
LogStash::VagrantHelpers.destroy(machines, options)
puts "Bootstrapping #{machines}"
LogStash::VagrantHelpers.bootstrap(machines, options)
end
@ -53,6 +55,7 @@ namespace :qa do
puts user_feedback_string_for("halting", args[:platform], machines, {"experimental" => experimental})
options = {:debug => ENV['LS_QA_DEBUG']}
puts "Halting #{machines}"
LogStash::VagrantHelpers.halt(machines, options)
end
end

View file

@ -66,12 +66,15 @@ class PlatformConfig
def filter_type(type_name, options={})
experimental = options.fetch("experimental", false)
@platforms.select { |platform| platform.type == type_name && platform.experimental == experimental }
@platforms.select do |platform|
(type_name.nil? ? true : platform.type == type_name) &&
platform.experimental == experimental
end
end
def select_names_for(platform, options={})
filter_options = { "experimental" => options.fetch("experimental", false) }
!platform.nil? ? filter_type(platform, filter_options).map{ |p| p.name } : ""
filter_type(platform, filter_options).map{ |p| p.name }
end
def types

View file

@ -6,17 +6,17 @@ require_relative "command"
module LogStash
class VagrantHelpers
def self.halt(machines="", options={})
def self.halt(machines=[], options={})
debug = options.fetch(:debug, false)
CommandExecutor.run!("vagrant halt #{machines.join(' ')}", debug)
end
def self.destroy(machines="", options={})
def self.destroy(machines=[], options={})
debug = options.fetch(:debug, false)
CommandExecutor.run!("vagrant destroy --force #{machines.join(' ')}", debug)
end
def self.bootstrap(machines="", options={})
def self.bootstrap(machines=[], options={})
debug = options.fetch(:debug, false)
CommandExecutor.run!("vagrant up #{machines.join(' ')}", debug)
end