Sha256: 9bfd361af75bc73d286306d10198033eed69612b68c58946bee423e70500be71
Contents?: true
Size: 1.02 KB
Versions: 15
Compression:
Stored size: 1.02 KB
Contents
class RenameAnsibleJobCategories < ActiveRecord::Migration[5.1] def up unless User.unscoped.find_by_login(User::ANONYMOUS_ADMIN) puts "No ANONYMOUS_ADMIN found. Skipping renaming Ansible jobs" return end User.as_anonymous_admin do updated_templates = ['Power Action - Ansible Default', 'Puppet Run Once - Ansible Default'] JobTemplate.without_auditing do job_templates = JobTemplate.where( :name => updated_templates ).all job_templates.each do |job_template| next if job_template.job_category =~ /^Ansible/ job_template.job_category = "Ansible #{job_template.job_category}" job_template.save end service_template = JobTemplate.where( :name => 'Service Action - Ansible Default' ).first if service_template.present? service_template.job_category = 'Ansible Services' service_template.save_without_auditing end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems