After testing a lot and do a fresh installation of Foreman (in parallel) i figured out, that something was wrong with the values of “category” in the database table “settings”. The value of category in the fresh installation was always “Setting”, in my old installation something like “Setting::Auth” or “Setting::RemoteExecution”, …
So i updated the table with “update settings set category = ‘Setting’ where category != ‘Setting’;” and started “foreman-rake db:seed” again. Now everything worked correctly - no errors.
Can anyone confirm that these values are correct?
Furthermore i updated Foreman from 2.5.4 → 3.0 → 3.1 → 3.2 → 3.3 and had a lot db errors (old entries, which cause db::migrade or db::seed to fail). Is it possible that some migrations do not work correctly (or in the past)?
For all who are in the same situation and get in trouble i would like to share my errors and experimental fixes (perhaps someone can also confirm, if this was correct :))
Error “Validation failed: Permissions You must select at least one permission” or “NoMethodError: undefined method locked?' for nil:NilClass, /usr/share/foreman/app/models/filter.rb:242:in
role_not_locked’”: there where a lot of orphaned records in the table “filters” and “filterings”.
Fix: Get all filters with no rule assigned (e.g. with hammer cli) and delete them with “delete from filterings where filter_id = XX;” and "delete from filters where id = XX;
Error “…uninitialized constant Environment”
Fix: Remove “… - Environment …” from table taxonomies with “update taxonomies set ignore_types = E’—\n- User\n- SmartProxy\n- Subnet\n- ComputeResource\n- Medium\n- ProvisioningTemplate\n- Ptable\n- Domain\n- Realm\n- Hostgroup\n’ where id=XX;”
Error: “The single-table inheritance mechanism failed to locate the subclass: ‘Setting::Auth’”
Fix: Update the table settings with “update settings set category = ‘Setting’ where category != ‘Setting’;”