Project

General

Profile

Actions

Bug #9045

closed

Migration PuppetclassTotalHosts does use a rake task

Added by Lukas Zapletal over 10 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Normal
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

It is unable to migrate a database that was not yet seeded but containing some Puppetclasses (e.g. older version of Foreman).

Since the Rake task is simple, the solution is to copy the code into migration:

  desc "Correct hosts counts for all classes in case they are wrong" 
  task :fix_total_hosts => :environment do
    if Puppetclass.count > 0
      User.current = User.anonymous_admin
      Puppetclass.all.each(&:update_total_hosts)
    end
  end

Actions

Also available in: Atom PDF