Sha256: 2a9756f0f0de2de5887ac4a52bcd18236b45fa48146c78df0c6058a3574813f0

Contents?: true

Size: 1002 Bytes

Versions: 15

Compression:

Stored size: 1002 Bytes

Contents

if Katello.with_remote_execution?
  User.as_anonymous_admin do
    JobTemplate.without_auditing do
      template_files = Dir[File.join("#{Katello::Engine.root}/app/views/foreman/job_templates/**/*.erb")]
      template_files.reject! { |file| file.end_with?('_ansible_default.erb') } unless Katello.with_ansible?
      template_files.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 << Organization.unscoped.all if template&.organizations&.empty?
        template.locations << Location.unscoped.all if template&.locations&.empty?
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
katello-3.16.2 db/seeds.d/75-job_templates.rb
katello-3.16.1.2 db/seeds.d/75-job_templates.rb
katello-3.16.1.1 db/seeds.d/75-job_templates.rb
katello-3.16.1 db/seeds.d/75-job_templates.rb
katello-3.16.0 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc5.1 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc5 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc4.1 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc4 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc3.1 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc3 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc2.1 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc2 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc1.1 db/seeds.d/75-job_templates.rb
katello-3.16.0.rc1 db/seeds.d/75-job_templates.rb