Merge branch 'week_4_merge_branch' of https://github.com/cliffe/SecGen into week_4_merge_branch

This commit is contained in:
secgen server
2017-10-31 11:31:22 +00:00
3 changed files with 16 additions and 6 deletions

View File

@@ -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

View File

@@ -199,7 +199,8 @@
<!--TODO: FIXME ftp modules are currently broken-->
<!--<service module_path=".*vsftpd"/>-->
<service type="httpd"/>
<!--TODO: Fix the apache module -->
<service module_path=".*lamp.*"/>
<!--<service module_path="services/unix/http/parameterised_website">
<input into="organisation">

View File

@@ -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