Sha256: 101e24c45afed8be2fdf94762220b3a58ebffcab4f5c92739212ff864352acd1

Contents?: true

Size: 957 Bytes

Versions: 32

Compression:

Stored size: 957 Bytes

Contents

organizations = Organization.unscoped.all
locations = Location.unscoped.all
if ForemanOpenscap.with_remote_execution?
  User.as_anonymous_admin do
    JobTemplate.without_auditing do
      Dir[File.join("#{ForemanOpenscap::Engine.root}/app/views/job_templates/**/*.erb")].each do |template|
        sync = !Rails.env.test? && Setting[:remote_execution_sync_templates]
        # import! was renamed to import_raw! around 1.3.1
        if JobTemplate.respond_to?('import_raw!')
          template = JobTemplate.import_raw!(File.read(template), :default => true, :locked => true, :update => sync)
        else
          template = JobTemplate.import!(File.read(template), :default => true, :locked => true, :update => sync)
        end
        template.organizations = organizations if SETTINGS[:organizations_enabled] && template.present?
        template.locations = locations if SETTINGS[:locations_enabled] && template.present?
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
foreman_openscap-4.0.2 db/seeds.d/75-job_templates.rb
foreman_openscap-4.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-3.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-4.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-3.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-2.0.2 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.10 db/seeds.d/75-job_templates.rb
foreman_openscap-2.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.9 db/seeds.d/75-job_templates.rb
foreman_openscap-2.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.8 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.7 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.6 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.5 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.4 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.3 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.2 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-1.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-0.12.3 db/seeds.d/75-job_templates.rb