Skip to content

Commit fe5e4f7

Browse files
Rearrange the cleanup handling
This patch moves the INT trap above the system provisioning as well as wrapping the call to `provision` in a rescue block that will avoid further execution. This should fix the issue where container and local VM tests continue to try and run the `provision` stage in the background even if the user wants to cancel all jobs. Cloud providers may need to address the issue in their `cleanup` method specifically.
1 parent 800e8bc commit fe5e4f7

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

lib/beaker-rspec/spec_helper.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,24 @@
4747

4848
# Configure all nodes in nodeset
4949
c.setup([fresh_nodes, '--hosts', nodesetfile, keyfile, debug, color, options_file].flatten.compact)
50-
c.provision
51-
c.validate
52-
c.configure
5350

5451
trap "SIGINT" do
5552
c.cleanup
5653
exit!(1)
5754
end
5855

56+
begin
57+
c.provision
58+
rescue StandardError => e
59+
logger.error(e)
60+
logger.info(e.backtrace)
61+
c.cleanup
62+
exit!(1)
63+
end
64+
65+
c.validate
66+
c.configure
67+
5968
# Destroy nodes if no preserve hosts
6069
c.after :suite do
6170
case options[:destroy]

0 commit comments

Comments
 (0)