Defect #869

Crash on migrate_from_trac

Added by John Goerzen almost 10 years ago. Updated over 9 years ago.

Status:ClosedStart date:2008-03-15
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Importers
Target version:0.7
Resolution:Fixed Affected version:

Description

This script has been working on most of my Trac instances. However, I am getting the below crash while it processes the tickets from one of them:

Migrating components..
Migrating milestones....
Migrating custom fields
Migrating tickets...rake aborted!
undefined method `regexp' for nil:NilClass
/home/redmine/redmine/app/models/custom_value.rb:33:in `validate'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:963:in `valid_without_callbacks?'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:273:in `valid?'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations.rb:1072:in `validate_associated_records_for_custom_values'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:125:in `each'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:125:in `send'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations/association_proxy.rb:125:in `method_missing'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations/association_collection.rb:162:in `method_missing'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/associations.rb:1067:in `validate_associated_records_for_custom_values'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:1000:in `send'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:1000:in `run_validations'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:998:in `each'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:998:in `run_validations'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:962:in `valid_without_callbacks?'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:273:in `valid?'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/validations.rb:933:in `save_without_transactions'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:120:in `rollback_active_record_state!'
/home/redmine/gems/gems/activerecord-2.0.2/lib/active_record/transactions.rb:108:in `save'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:347:in `migrate'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:332:in `each'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:332:in `migrate'
/home/redmine/redmine/lib/tasks/migrate_from_trac.rake:619
/usr/lib/ruby/1.8/rake.rb:387:in `call'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:387:in `each'
/usr/lib/ruby/1.8/rake.rb:387:in `execute'
/usr/lib/ruby/1.8/rake.rb:357:in `invoke'
/usr/lib/ruby/1.8/thread.rb:135:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:350:in `invoke'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/lib/ruby/1.8/rake.rb:1906:in `each'
/usr/lib/ruby/1.8/rake.rb:1906:in `run'
/usr/bin/rake:4

Associated revisions

Revision 1286
Added by Jean-Philippe Lang over 9 years ago

Trac importer: prevent validation failure due to the default value when saving the Resolution custom field if it already exists (#869).

History

#1 Updated by John Goerzen almost 10 years ago

It seems that all tickets that trigger this are marked closed in trac.

#2 Updated by John Goerzen almost 10 years ago

Found the problem, but not sure how to fix.

I have a global custom field set up named "Resolution". It appears that migrate_from_trac is finding this, but crashes when a Trac ticket has a resolution that does not occur in my global custom field in Redmine.

My workaround was to add trac names to my Redmine custom field.

#3 Updated by Jean-Philippe Lang over 9 years ago

  • Category set to Importers
  • Target version set to 0.7
  • Resolution set to Fixed

I could reproduce this problem. I guess it occured because you had a custom field named Resolution with a default value not in %w(fixed invalid wontfix duplicate worksforme).

Fix applied in r1286.

#4 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from New to Resolved

#5 Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF