From 6b87f6ca312829cb7c488077865e348cf34034c7 Mon Sep 17 00:00:00 2001 From: secgen server Date: Fri, 13 Oct 2017 11:47:39 +0100 Subject: [PATCH] pushing work from server --- lib/batch/batch_secgen.rb | 2 +- secgen.rb | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/batch/batch_secgen.rb b/lib/batch/batch_secgen.rb index 4948fa481..658768757 100644 --- a/lib/batch/batch_secgen.rb +++ b/lib/batch/batch_secgen.rb @@ -109,7 +109,7 @@ def get_delete_opts end def parse_opts(opts) - options = {:instances => '', :max_threads => 1, :id => '', :all => false} + options = {:instances => '', :max_threads => 3, :id => '', :all => false} opts.each do |opt, arg| case opt when '--instances' diff --git a/secgen.rb b/secgen.rb index 99d8c3b4e..213d1bae0 100644 --- a/secgen.rb +++ b/secgen.rb @@ -133,7 +133,7 @@ def build_vms(project_dir, options) command = '--provision reload' end - retry_count = (options[:ovirtuser] and options[:ovirtpass]) ? 5 : 0 + retry_count = (options[:ovirtuser] and options[:ovirtpass]) ? 10 : 0 successful_creation = false while retry_count and !successful_creation @@ -149,8 +149,13 @@ def build_vms(project_dir, options) end else if retry_count > 0 - Print.err 'Error creating VMs, retrying...' - command += ' --provision' unless command.include? ' --provision' + Print.err 'Error creating VMs, destroying VMs and retrying...' + if GemExec.exe('vagrant', project_dir, 'destroy') + Print.info 'VMs destroyed' + else + Print.err 'Failed to destroy VMs. Exiting.' + exit 1 + end sleep(10) else Print.err 'Error creating VMs, exiting SecGen.'