Actions
Bug #2343
closedapp/models/setting.rb#default chokes on nil attributes
Description
On a freshly installed wheezy with the 1.1.1+debian1 packages from deb.theforeman.org, I get the following trace:
rake aborted! can't convert nil into String /usr/lib/ruby/1.9.1/psych.rb:203:in `parse' /usr/lib/ruby/1.9.1/psych.rb:203:in `parse_stream' /usr/lib/ruby/1.9.1/psych.rb:151:in `parse' /usr/lib/ruby/1.9.1/psych.rb:127:in `load' /usr/share/foreman/app/models/setting.rb:77:in `default' /usr/share/foreman/app/models/setting.rb:63:in `value=' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:1569:in `block in attributes=' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:1565:in `each' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:1565:in `attributes=' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/base.rb:1416:in `initialize' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/validations.rb:32:in `new' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/validations.rb:32:in `create!' /usr/share/foreman/lib/foreman/default_settings/loader.rb:21:in `create' /usr/share/foreman/lib/foreman/default_settings/loader.rb:77:in `block (2 levels) in load' /usr/share/foreman/lib/foreman/default_settings/loader.rb:61:in `each' /usr/share/foreman/lib/foreman/default_settings/loader.rb:61:in `block in load' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction' /usr/share/foreman/vendor/ruby/1.9.1/gems/activerecord-3.0.20/lib/active_record/transactions.rb:207:in `transaction' /usr/share/foreman/lib/foreman/default_settings/loader.rb:33:in `load' /usr/share/foreman/config/initializers/foreman.rb:4:in `<top (required)>' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in `load' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in `block in load' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:227:in `load_dependency' /usr/share/foreman/vendor/ruby/1.9.1/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in `load' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/engine.rb:201:in `block (2 levels) in <class:Engine>' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/engine.rb:200:in `each' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/engine.rb:200:in `block in <class:Engine>' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/initializable.rb:25:in `instance_exec' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/initializable.rb:25:in `run' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/initializable.rb:50:in `block in run_initializers' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/initializable.rb:49:in `each' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/initializable.rb:49:in `run_initializers' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/application.rb:134:in `initialize!' /usr/share/foreman/vendor/ruby/1.9.1/gems/railties-3.0.20/lib/rails/application.rb:77:in `method_missing' /usr/share/foreman/config/environment.rb:5:in `<top (required)>' [...]
I've added debugging to the "default" method and it dies with "modulepath is nil".
Returning nil instead of raising an exception let the db:migrate run through.
Actions