Sha256: 7df28490543e1268844c6b073cf96dd5ae602b7e7aac19153d42cc4a98cd339e

Contents?: true

Size: 1.24 KB

Versions: 56

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

organizations = Organization.unscoped.all
locations = Location.unscoped.all
User.as_anonymous_admin do
  RemoteExecutionFeature.without_auditing do
    if Rails.env.test? || Foreman.in_rake?
      # If this file tries to import a template with a REX feature in a SeedsTest,
      # it will fail - the REX feature isn't registered on SeedsTest because
      # DatabaseCleaner truncates the db before every test.
      # During db:seed, we also want to know the feature is registered before
      # seeding the template
      ForemanAnsible::Engine.register_rex_feature
    end
    JobTemplate.without_auditing do
      Dir[File.join("#{ForemanAnsible::Engine.root}/app/views/foreman_ansible/"\
                    'job_templates/**/*.erb')].each do |template|
        sync = !Rails.env.test? && Setting[:remote_execution_sync_templates]
        template = JobTemplate.import_raw!(File.read(template),
                                           :default => true,
                                           :lock => true,
                                           :update => sync)
        template.organizations = organizations if template.present?
        template.locations = locations if template.present?
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
foreman_ansible-11.0.0 db/seeds.d/75_job_templates.rb
foreman_ansible-10.2.0 db/seeds.d/75_job_templates.rb
foreman_ansible-10.1.0 db/seeds.d/75_job_templates.rb
foreman_ansible-10.0.1 db/seeds.d/75_job_templates.rb
foreman_ansible-10.0.0 db/seeds.d/75_job_templates.rb
foreman_ansible-7.1.4 db/seeds.d/75_job_templates.rb
foreman_ansible-9.0.1 db/seeds.d/75_job_templates.rb
foreman_ansible-7.1.3 db/seeds.d/75_job_templates.rb
foreman_ansible-9.0.0 db/seeds.d/75_job_templates.rb
foreman_ansible-7.1.2 db/seeds.d/75_job_templates.rb
foreman_ansible-7.1.1 db/seeds.d/75_job_templates.rb
foreman_ansible-8.0.1 db/seeds.d/75_job_templates.rb
foreman_ansible-8.0.0 db/seeds.d/75_job_templates.rb
foreman_ansible-7.0.4 db/seeds.d/75_job_templates.rb
foreman_ansible-7.1.0 db/seeds.d/75_job_templates.rb
foreman_ansible-7.0.3 db/seeds.d/75_job_templates.rb
foreman_ansible-7.0.2 db/seeds.d/75_job_templates.rb
foreman_ansible-7.0.1 db/seeds.d/75_job_templates.rb
foreman_ansible-7.0.0 db/seeds.d/75_job_templates.rb
foreman_ansible-6.3.4 db/seeds.d/75_job_templates.rb