Sha256: 0bd7a435b06a8d85bf43a8c9bdace9e2e70581118a6a2102892db7853c518fb5

Contents?: true

Size: 881 Bytes

Versions: 27

Compression:

Stored size: 881 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, :lock => true, :update => sync)
        else
          template = JobTemplate.import!(File.read(template), :default => true, :lock => true, :update => sync)
        end
        next unless template.present?
        template.organizations = organizations
        template.locations = locations
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foreman_openscap-10.1.0 db/seeds.d/75-job_templates.rb
foreman_openscap-10.0.3 db/seeds.d/75-job_templates.rb
foreman_openscap-10.0.2 db/seeds.d/75-job_templates.rb
foreman_openscap-10.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-10.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-9.0.4 db/seeds.d/75-job_templates.rb
foreman_openscap-9.0.3 db/seeds.d/75-job_templates.rb
foreman_openscap-9.0.2 db/seeds.d/75-job_templates.rb
foreman_openscap-9.0.1 db/seeds.d/75-job_templates.rb
foreman_openscap-9.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-8.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-7.1.1 db/seeds.d/75-job_templates.rb
foreman_openscap-7.1.0 db/seeds.d/75-job_templates.rb
foreman_openscap-7.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-6.0.0 db/seeds.d/75-job_templates.rb
foreman_openscap-5.2.3 db/seeds.d/75-job_templates.rb
foreman_openscap-5.2.2 db/seeds.d/75-job_templates.rb
foreman_openscap-5.1.1 db/seeds.d/75-job_templates.rb
foreman_openscap-5.2.1 db/seeds.d/75-job_templates.rb
foreman_openscap-5.2.0 db/seeds.d/75-job_templates.rb