Bug #17330
closedInitially seeding the database fails with "TypeError: can't dup NilClass"
Description
Following the instructions at https://theforeman.org/contribute.html I do
rm db/*.sqlite3
cp config/settings.yaml.example config/settings.yaml
bundle exec bin/rake db:migrate
bundle exec bin/rake db:seed
The last step fails with:
2016-11-14T21:36:36 [app] [W] unknown class ExternalUsergroups, ignoring | NameError: uninitialized constant ExternalUsergroups | /var/scratch/src/foreman/foreman/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:261:in `const_get' | /var/scratch/src/foreman/foreman/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:261:in `block in constantize' | /var/scratch/src/foreman/foreman/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7.1/lib/active_support/inflector/methods.rb:259:in `each'
Full log attached.
Files
Updated by Marek Hulán over 8 years ago
What version of Foreman have you installed? First warning appears on call at 03-roles.rb on line 63 when it tries to create the role for external usergroups. I suppose it's because permissions define resource type as ExternalUsergroups instead of ExternalUsergroup (singular), this was present since Foreman 1.7 (introduced in #3976) and is ignored.
The error causing the task to fail is this
rake aborted! TypeError: can't dup NilClass /var/scratch/src/foreman/foreman/db/seeds.d/04-admin.rb:38:in `dup' /var/scratch/src/foreman/foreman/db/seeds.d/04-admin.rb:38:in `block (2 levels) in <top (required)>'
As an easy workaround, set SEED_ADMIN_EMAIL variable to email address for your admin user and rerun the task, e.g.
SEED_ADMIN_EMAIL=admin@example.com bundle exec bin/rake db:seed
Updated by The Foreman Bot over 8 years ago
- Status changed from New to Ready For Testing
- Assignee set to Marek Hulán
- Pull request https://github.com/theforeman/foreman/pull/4020 added
Updated by Sebastian Gräßl over 8 years ago
I can confirm this error, but the "error" in question should according to Dominic's note (http://projects.theforeman.org/issues/16204#note-1) not be treated as such.
My suggestion would be to look into omitting the backtrace, when it is a warning to not raise confusion about it being something to worry about.
Plus, an explanation why it is "ignorable" would make sense here as well, maybe.
Updated by Dominic Cleal over 8 years ago
- Related to Bug #16204: NameError: uninitialized constant ExternalUsergroups added
Updated by Dominic Cleal over 8 years ago
- Subject changed from Initially seeding the database failes to Initially seeding the database fails with "TypeError: can't dup NilClass"
This ticket's about the error "TypeError: can't dup NilClass" causing a failure, the warning didn't cause the failure and can be addressed under #16204.
Updated by Guido Günther over 8 years ago
Marek Hulán wrote:
As an easy workaround, set SEED_ADMIN_EMAIL variable to email address for your admin user and rerun the task, e.g.
I can confirm this works.
Updated by Marek Hulán over 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset f2c05b8d3b46053d1412bf9ce79697cfd610cc8a.
Updated by Dominic Cleal over 8 years ago
- Translation missing: en.field_release set to 209