diff --git a/config/initializers/z_11_plugin_templates.rb b/config/initializers/z_11_plugin_templates.rb index 13033bd46..4bfbb23f7 100644 --- a/config/initializers/z_11_plugin_templates.rb +++ b/config/initializers/z_11_plugin_templates.rb @@ -7,13 +7,16 @@ # Unless the DB is already migrated, do nothing Rails.application.reloader.to_prepare do - if (ActiveRecord::Base.connection rescue false) && Configuration.table_exists? && Configuration.paths_templates.exist? + if (ActiveRecord::Base.connection rescue false) && + Configuration.table_exists? && + Configuration.paths_templates.exist? && + Mapping.table_exists? # ---------------------------------------------------------------- 3.1 Upload template_dir = Configuration.paths_templates_plugins - + # mappings table may not exist when migrating from an old OVA to a new one so we need this guard Dradis::Plugins::with_feature(:upload).each do |integration| integration.copy_samples(to: template_dir) - integration.migrate_templates_to_mappings(from: template_dir) + integration.migrate_templates_to_mappings(from: template_dir) if !Rails.env.test? end # ---------------------------------------------------------------- 3.2 Export