Sha256: 71ceeddff2d6fc89943f60a8c8a98451641f924605fa42cf6502b007365b4650

Contents?: true

Size: 913 Bytes

Versions: 6

Compression:

Stored size: 913 Bytes

Contents

User.as_anonymous_admin do
  if Rails.env.test? || File.basename($0) == '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]
      JobTemplate.import_raw!(File.read(template),
                              :default => true,
                              :locked => true,
                              :update => sync)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
foreman_ansible-2.0.4 db/seeds.d/75_job_templates.rb
foreman_ansible-2.0.3 db/seeds.d/75_job_templates.rb
foreman_ansible-2.0.2 db/seeds.d/75_job_templates.rb
foreman_ansible-2.1.0 db/seeds.d/75_job_templates.rb
foreman_ansible-2.0.1 db/seeds.d/75_job_templates.rb
foreman_ansible-2.0.0 db/seeds.d/75_job_templates.rb