Actions
Bug #10426
closedError when running 20150423134004_add_content_host_id_to_smart_proxy database migration
Description
I have one smart proxy, but the migration still fails:
[vagrant@katello-centos7-devel foreman]$ rake db:migrate The Apipie cache is turned off. Enable it and run apipie:cache rake task to speed up API calls. Workaround for RbVmomi may not work as ComputeResource is already loaded: ComputeResource [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message. == AddContentHostIdToSmartProxy: migrating =================================== -- add_column(:smart_proxies, :content_host_id, :integer) -> 0.0010s -- add_foreign_key(:smart_proxies, :katello_systems, {:column=>"content_host_id"}) -> 0.0020s rake aborted! StandardError: An error has occurred, this and all later migrations canceled: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id/home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:15:in `block in change' /home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:12:in `each' /home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:12:in `change' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:407:in `block (2 levels) in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:407:in `block in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `call' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `block in ddl_transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `ddl_transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `<main>' caused by: (RuntimeError) Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id ... skipped 43 lines Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id /home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:15:in `block in change' /home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:12:in `each' /home/vagrant/code/katello/db/migrate/20150423134004_add_content_host_id_to_smart_proxy.rb:12:in `change' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:407:in `block (2 levels) in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:407:in `block in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `call' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `block in ddl_transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `ddl_transaction' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.21/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `eval' /home/vagrant/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:15:in `<main>' Tasks: TOP => db:migrate (See full trace by running task with --trace)
Steps to Reproduce
1. Run rake db:migrate
2. Note error
Actions