Incorrect FixPuppetclassTotalHosts migration

Hey,

I had to restore backup of my development sqlite database from November
last year and it turns out I can't migrate anymore to develop:

== FixPuppetclassTotalHosts: migrating =======================================
** Invoke puppet:fix_total_hosts (first_time)
** Invoke environment
** Execute puppet:fix_total_hosts
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

ERF42-6794 [Foreman::Exception]: Anonymous admin user foreman_admin is missing, run foreman-rake db:seed/home/lzap/work/foreman/app/models/user.rb:168:in anonymous_admin&#39; /home/lzap/work/foreman/lib/tasks/puppet.rake:223:inblock (2 levels) in <top (required)>'

When I try to seed, I am given an advice to migrate :slight_smile:

You have 10 pending migrations:
20141110084848 FixPuppetclassTotalHosts
20141112165600 AddTypeToParameterIndex
20141120140051 RemoveAuditUserFk
20141124055509 RenameSmartProxyAuthRelatedSettings
20141126165451 AddDiscoveryIdToSubnet
20141203082104 MakeTemplatesDefault
20141223101707 CreateDiscoveryAttributeSets
20141223142759 FillDiscoveryAttributeSetsForExistingHosts
20141225073211 AddDescriptionToTaxonomies
20150114141626 ActuallyRenameSmartProxyAuthRelatedSettings
Run rake db:migrate to update your database then try again.

We use a rake task from migration which is not the best thing to do I think
since rake tasks boot whole environment.

To proceed, one needs to comment out the following migration:

db/migrate/20141110084848_fix_puppetclass_total_hosts.rb

Migrate, seed, uncomment and migrate again. I filed a bug, fix is easy. Leaving
this just for the record.

http://projects.theforeman.org/issues/9045

ยทยทยท -- Later, Lukas #lzap Zapletal