Project

General

Profile

Actions

Bug #6873

closed

Error during db:seed from 1.4 to 1.6: undefined method `expire_topbar_cache' for nil:NilClass

Added by Dominic Cleal over 10 years ago. Updated over 6 years ago.

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

Description

Maybe because the hidden users created in #3272 aren't visible via the default scope, and the UserRole's owner field is nil.

$ rake db:seed
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/03-auth_sources.rb
Seeding /home/dcleal/code/foreman/foreman/db/seeds.d/04-admin.rb
rake aborted!
NoMethodError: undefined method `expire_topbar_cache' for nil:NilClass
/home/dcleal/code/foreman/foreman/app/models/user_role.rb:40:in `expire_topbar_cache'
/home/dcleal/code/foreman/foreman/app/controllers/topbar_sweeper.rb:5:in `after_create'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activemodel-3.2.18/lib/active_model/observing.rb:231:in `update'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/observer.rb:114:in `block (2 levels) in define_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:409:in `_run__546721024796332261__create__4000062208614984543__callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/callbacks.rb:268:in `create'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/persistence.rb:348:in `create_or_update'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/callbacks.rb:264:in `block in create_or_update'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:447:in `_run__546721024796332261__save__4000062208614984543__callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/callbacks.rb:264:in `create_or_update'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/persistence.rb:104:in `save!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/validations.rb:56:in `save!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/attribute_methods/dirty.rb:33:in `save!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:264:in `block in save!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:208:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:264:in `save!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/has_many_through_association.rb:85:in `save_through_record'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/has_many_through_association.rb:52:in `insert_record'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:496:in `block (2 levels) in concat_records'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:344:in `add_to_target'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:495:in `block in concat_records'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:493:in `each'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:493:in `concat_records'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:134:in `block in concat'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:149:in `block in transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:208:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:148:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_association.rb:134:in `concat'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/has_many_through_association.rb:38:in `concat'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/associations/collection_proxy.rb:118:in `<<'
/home/dcleal/code/foreman/foreman/app/models/user.rb:494:in `ensure_default_role'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:449:in `_run__757971595587470615__save__4000062208614984543__callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/callbacks.rb:264:in `create_or_update'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/persistence.rb:84:in `save'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/validations.rb:50:in `save'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/attribute_methods/dirty.rb:22:in `save'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:259:in `block (2 levels) in save'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:208:in `transaction'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:311:in `with_transaction_returning_status'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:259:in `block in save'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:270:in `rollback_active_record_state!'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/transactions.rb:258:in `save'
/home/dcleal/code/foreman/foreman/db/seeds.d/04-admin.rb:14:in `block in <top (required)>'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/audited-3.0.0/lib/audited/auditor.rb:250:in `call'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/audited-3.0.0/lib/audited/auditor.rb:250:in `without_auditing'
/home/dcleal/code/foreman/foreman/db/seeds.d/04-admin.rb:9:in `<top (required)>'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `block in load'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
/home/dcleal/code/foreman/foreman/db/seeds.rb:67:in `block in <top (required)>'
/home/dcleal/code/foreman/foreman/db/seeds.rb:65:in `each'
/home/dcleal/code/foreman/foreman/db/seeds.rb:65:in `<top (required)>'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `block in load'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:245:in `load'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/railties-3.2.18/lib/rails/engine.rb:525:in `load_seed'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/gems/activerecord-3.2.18/lib/active_record/railties/databases.rake:347:in `block (2 levels) in <top (required)>'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/bin/ruby_executable_hooks:15:in `eval'
/home/dcleal/.rvm/gems/ruby-2.0.0-p353@foreman/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:seed
(See full trace by running task with --trace)

Related issues 4 (1 open3 closed)

Related to Foreman - Feature #3272: Separate internal admin account from user admin accountsClosedDominic Cleal10/16/2013Actions
Related to Foreman - Bug #6065: Inverting the admin flag has no effect on menu cacheClosedGreg Sutcliffe06/04/2014Actions
Related to Foreman - Refactor #6878: Replace default_scope with specific scopes for visibilityNew08/01/2014Actions
Related to Foreman - Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint"ClosedDominic Cleal08/06/2014Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Related to Feature #3272: Separate internal admin account from user admin accounts added
Actions #2

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #6065: Inverting the admin flag has no effect on menu cache added
Actions #3

Updated by Dominic Cleal over 10 years ago

  • Related to Refactor #6878: Replace default_scope with specific scopes for visibility added
Actions #4

Updated by Dominic Cleal over 10 years ago

  • Assignee set to Dominic Cleal
Actions #5

Updated by The Foreman Bot over 10 years ago

  • Status changed from New to Ready For Testing
  • Target version set to 1.7.5
  • Pull request https://github.com/theforeman/foreman/pull/1641 added
  • Pull request deleted ()
Actions #6

Updated by Dominic Cleal over 10 years ago

  • Translation missing: en.field_release set to 10
Actions #7

Updated by Dominic Cleal over 10 years ago

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

Updated by Dominic Cleal over 10 years ago

  • Related to Bug #6964: Error on startup: "null value in column "user_id" violates not-null constraint" added
Actions

Also available in: Atom PDF