Bug #17330
closed
Initially seeding the database fails with "TypeError: can't dup NilClass"
Added by Guido Günther about 8 years ago.
Updated over 6 years ago.
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
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
- Status changed from New to Ready For Testing
- Assignee set to Marek Hulán
- Pull request https://github.com/theforeman/foreman/pull/4020 added
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.
- Related to Bug #16204: NameError: uninitialized constant ExternalUsergroups added
- 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.
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.
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Target version set to 1.11.2
- Translation missing: en.field_release set to 209
Also available in: Atom
PDF