mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-23 04:08:02 +00:00
Retry loop improvements: pushing to test
This commit is contained in:
@@ -37,12 +37,20 @@ class GemExec
|
||||
end
|
||||
|
||||
Dir.chdir(working_dir)
|
||||
output_hash = {:output => '', :status => 0}
|
||||
output_hash = {:output => '', :status => 0, :exception => nil}
|
||||
begin
|
||||
output_hash[:output] = ProcessHelper.process("#{gem_path} #{arguments}", {:timeout => (60*40)})
|
||||
output_hash[:output] = ProcessHelper.process("#{gem_path} #{arguments}", {:timeout => (30),
|
||||
include_output_in_exception: true})
|
||||
rescue Exception => ex
|
||||
output_hash[:output] = ex.to_s.split('Command output: ')[1]
|
||||
output_hash[:status] = 1
|
||||
output_hash[:exception] = ex
|
||||
if ex.type == ProcessHelper::UnexpectedExitStatusError
|
||||
output_hash[:output] = ex.to_s.split('Command output: ')[1]
|
||||
elsif ex.type == ProcessHelper::TimeoutError
|
||||
output_hash[:output] = ex.to_s.split('Command output prior to timeout: ')[1]
|
||||
else
|
||||
output_hash[:output] = nil
|
||||
end
|
||||
end
|
||||
output_hash
|
||||
end
|
||||
|
||||
@@ -149,7 +149,7 @@ def build_vms(project_dir, options)
|
||||
else
|
||||
if retry_count > 0
|
||||
# Identify which VMs failed
|
||||
if vagrant_output[:output] != nil
|
||||
if vagrant_output[:exception].type == ProcessHelper::UnexpectedExitStatusError
|
||||
split = vagrant_output[:output].split('==>')
|
||||
failures = []
|
||||
split.each do |line|
|
||||
@@ -177,7 +177,8 @@ def build_vms(project_dir, options)
|
||||
GemExec.exe('vagrant', project_dir, 'destroy')
|
||||
end
|
||||
else
|
||||
Print.err 'Error creating VMs, exiting SecGen.'
|
||||
Print.err 'Error provisioning VMs, destroying VMs and exiting SecGen.'
|
||||
GemExec.exe('vagrant', project_dir, 'destroy')
|
||||
exit 1
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user