Project

General

Profile

Actions

Refactor #23939

open

Template "default" should cause templates to be seeded into all existing orgs and future ones

Added by Stephen Benjamin almost 6 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Templates
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

The original idea behind "default" flag for templates is that they go into every new taxonomy. It should happen during seeding, and on new org/loc creation, but it doesn't seem like that's working correctly. Foreman_ansible, remote execution, and core all do this themselves manually in their seeders. To avoid duplication of this code, it would be nice if this could happen in the Template model.


Related issues 1 (0 open1 closed)

Related to Foreman Remote Execution - Bug #23891: Community Job Templates are not assigned to all orgs by defaultClosedMarek Hulán05/30/2018Actions
Actions #1

Updated by Stephen Benjamin almost 6 years ago

  • Related to Bug #23891: Community Job Templates are not assigned to all orgs by default added
Actions #2

Updated by Stephen Benjamin almost 6 years ago

  • Bugzilla link set to 1602875
Actions #3

Updated by Ivan Necas almost 6 years ago

  • Triaged set to No

Do I understand it correctly, that it would mean having some `seed` method in the Templates, that would do:

def self.seed(template)
  sync = !Rails.env.test? && Setting[:remote_execution_sync_templates]
  template = import_raw!(File.read(template), :default => true, :locked => true, :update => sync)
  template.organizations = organizations if SETTINGS[:organizations_enabled] && template.present?
  template.locations = locations if SETTINGS[:locations_enabled] && template.present?
end
Actions

Also available in: Atom PDF