Project

General

Profile

Actions

Bug #17330

closed

Initially seeding the database fails with "TypeError: can't dup NilClass"

Added by Guido Günther over 7 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
DB migrations
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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

seed-failure.log seed-failure.log 77.9 KB Guido Günther, 11/14/2016 03:39 PM

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #16204: NameError: uninitialized constant ExternalUsergroupsClosedOndřej Pražák08/19/2016Actions
Actions #1

Updated by Marek Hulán over 7 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
Actions #2

Updated by The Foreman Bot over 7 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
Actions #3

Updated by Sebastian Gräßl over 7 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.

Actions #4

Updated by Dominic Cleal over 7 years ago

  • Related to Bug #16204: NameError: uninitialized constant ExternalUsergroups added
Actions #5

Updated by Dominic Cleal over 7 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.

Actions #6

Updated by Guido Günther over 7 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.

Actions #7

Updated by Marek Hulán about 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #8

Updated by Marek Hulán about 7 years ago

  • Target version set to 1.11.2
Actions #9

Updated by Dominic Cleal about 7 years ago

  • translation missing: en.field_release set to 209
Actions

Also available in: Atom PDF