Open mithrandir1 opened 10 years ago
Hello!
Both bugzilla and redmine are using mysql databases, the script aborts at the issue migration:
Migrating profiles ................................................... Migrating products.................................... Migrating relationship product/profile Migrating issues rake aborted! Validation failed: Tracker is not included in the list /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/validations.rb:56:in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/dirty.rb:33:insave!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:in block in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:313:inblock in with_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in transaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:208:intransaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:311:in with_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:insave!' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:403:in block in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:ineach' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:574:inmodule:BugzillaMigrate' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:46:in block (2 levels) in <top (required)>' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:incall' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:in block in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:ineach' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:175:inblock in invoke_with_call_chain' /usr/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:168:ininvoke_with_call_chain' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:161:in invoke' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:149:ininvoke_task' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in block (2 levels) in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:ineach' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in block in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:115:inrun_with_threads' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:100:in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:78:inblock in run' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:165:in standard_exception_handling' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:75:inrun' /var/lib/gems/2.1.0/gems/rake-10.1.1/bin/rake:33:in <top (required)>' /usr/local/bin/rake:23:inload' /usr/local/bin/rake:23:in `' Tasks: TOP => redmine:migrate_from_bugzilla
save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/dirty.rb:33:in
block in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:313:in
transaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:208:in
with_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:in
block in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:in
migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:574:in
block (2 levels) in <top (required)>' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:in
block in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:in
execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:175:in
mon_synchronize' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:168:in
invoke' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:149:in
block (2 levels) in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in
block in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:115:in
top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:78:in
standard_exception_handling' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:75:in
<top (required)>' /usr/local/bin/rake:23:in
After some research I found the cause of the problem. You have to assign the tracker "Bug" to the newly created project, so I added the line 316:
BugzillaProduct.find_each do |product| project = Project.new project.name = product.name project.description = product.description project.identifier = "#{product.name.downcase.gsub(/[^a-z0-9]+/, '-')[0..10]}-#{product.id}" project.is_public = false project.trackers << TRACKER_BUG unless project.trackers.include?(TRACKER_BUG) project.save!
Then the migration worked like a charm.
Hello!
Both bugzilla and redmine are using mysql databases, the script aborts at the issue migration:
Migrating profiles ................................................... Migrating products.................................... Migrating relationship product/profile Migrating issues rake aborted! Validation failed: Tracker is not included in the list /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/validations.rb:56:in'
Tasks: TOP => redmine:migrate_from_bugzilla
save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/attribute_methods/dirty.rb:33:in
save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:inblock in save!' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:313:in
block in with_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/database_statements.rb:192:intransaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:208:in
transaction' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:311:inwith_transaction_returning_status' /var/lib/gems/2.1.0/gems/activerecord-3.2.19/lib/active_record/transactions.rb:264:in
save!' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:403:inblock in migrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:in
each' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:371:inmigrate_issues' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:574:in
module:BugzillaMigrate' /opt/redmine/lib/tasks/migrate_from_bugzilla.rake:46:inblock (2 levels) in <top (required)>' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:in
call' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:236:inblock in execute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:in
each' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:231:inexecute' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:175:in
block in invoke_with_call_chain' /usr/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:168:in
invoke_with_call_chain' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/task.rb:161:ininvoke' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:149:in
invoke_task' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:inblock (2 levels) in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:in
each' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:106:inblock in top_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:115:in
run_with_threads' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:100:intop_level' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:78:in
block in run' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:165:instandard_exception_handling' /var/lib/gems/2.1.0/gems/rake-10.1.1/lib/rake/application.rb:75:in
run' /var/lib/gems/2.1.0/gems/rake-10.1.1/bin/rake:33:in<top (required)>' /usr/local/bin/rake:23:in
load' /usr/local/bin/rake:23:in `After some research I found the cause of the problem. You have to assign the tracker "Bug" to the newly created project, so I added the line 316:
Then the migration worked like a charm.