Project

General

Profile

Actions

Bug #422

closed

ReportObserver#after_save fails when erroneous is being processed

Added by Jochen Schalanda about 14 years ago. Updated about 14 years ago.

Status:
Closed
Priority:
Normal
Category:
Reporting
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

The next statement in app/models/report_observer.rb, line 8 is wrong is this context as next is only to be used to skip the current iteration of a loop.

This will cause an error when dealing with broken reports, e. g. in the database migration ConvertReports.

# rake db:migrate --trace
(in /srv/foreman)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
==  ConvertReports: migrating =================================================
-- About to convert all of the 8881 reports log field into a more DB optimized way... this might take a while.....
rake aborted!
An error has occurred, this and all later migrations canceled:

unexpected next
/srv/foreman/app/models/report_observer.rb:8:in `after_save'
/srv/foreman/vendor/rails/activerecord/lib/active_record/observer.rb:171:in `send'
/srv/foreman/vendor/rails/activerecord/lib/active_record/observer.rb:171:in `update'
/usr/lib/ruby/1.8/observer.rb:185:in `notify_observers'
/usr/lib/ruby/1.8/observer.rb:184:in `each'
/usr/lib/ruby/1.8/observer.rb:184:in `notify_observers'
/srv/foreman/vendor/rails/activerecord/lib/active_record/callbacks.rb:357:in `notify'
/srv/foreman/vendor/rails/activerecord/lib/active_record/callbacks.rb:350:in `callback'
/srv/foreman/vendor/rails/activerecord/lib/active_record/callbacks.rb:251:in `create_or_update'
/srv/foreman/vendor/rails/activerecord/lib/active_record/base.rb:2538:in `save_without_validation'
/srv/foreman/vendor/rails/activerecord/lib/active_record/validations.rb:1078:in `save_without_dirty'
/srv/foreman/vendor/rails/activerecord/lib/active_record/dirty.rb:79:in `save_without_transactions'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `send'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:229:in `with_transaction_returning_status'
/srv/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_unsaved_flag'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:196:in `save_without_unsaved_flag'
/srv/foreman/vendor/plugins/active_scaffold/lib/extensions/unsaved_record.rb:15:in `save'
./db/migrate//20101019183859_convert_reports.rb:26:in `up_without_benchmarks'
./db/migrate//20101019183859_convert_reports.rb:5:in `each'
./db/migrate//20101019183859_convert_reports.rb:5:in `up_without_benchmarks'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `__send__'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `migrate'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:486
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:560:in `call'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:560:in `ddl_transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:560:in `ddl_transaction'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:485:in `migrate'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `each'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `migrate'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'
/srv/foreman/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
/srv/foreman/vendor/rails/railties/lib/tasks/databases.rake:116
/usr/lib/ruby/1.8/rake.rb:636:in `call'
/usr/lib/ruby/1.8/rake.rb:636:in `execute'
/usr/lib/ruby/1.8/rake.rb:631:in `each'
/usr/lib/ruby/1.8/rake.rb:631:in `execute'
/usr/lib/ruby/1.8/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib/ruby/1.8/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/rake.rb:583:in `invoke'
/usr/lib/ruby/1.8/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2029:in `each'
/usr/lib/ruby/1.8/rake.rb:2029:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2023:in `top_level'
/usr/lib/ruby/1.8/rake.rb:2001:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28


Files

Actions #1

Updated by Jochen Schalanda about 14 years ago

  • File 0001-Fixes-bug-422-broken-records-will-now-be-handled-cor.patch added
Actions #3

Updated by Ohad Levy about 14 years ago

  • File deleted (0001-Fixes-bug-422-broken-records-will-now-be-handled-cor.patch)
Actions #4

Updated by Jochen Schalanda about 14 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100
Actions #5

Updated by Ohad Levy about 14 years ago

  • Status changed from Ready For Testing to Closed
  • Assignee set to Jochen Schalanda
Actions

Also available in: Atom PDF