Bug 1341974

Summary: Upgrade [6.1.9 -> 6.2 snap14] db:migrate failed with undefined method `importing_facts=' for #<Host::Managed:0x00000008cf1e78>
Product: Red Hat Satellite Reporter: Sachin Ghai <sghai>
Component: UpgradesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: mhulan
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-02 09:42:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1335807    
Attachments:
Description Flags
complete_execption
none
foreman-debug none

Description Sachin Ghai 2016-06-02 07:51:55 UTC
Description of problem:
On performing upgrade from sat6.1.9 -> sat6.2 snap14 on rhel7, Installer failed with following error:

Upgrade Step: Running installer...
 /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: /usr/sbin/foreman-rake db:migrate returned 1 instead of one of [0]
 /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: /usr/sbin/foreman-rake db:migrate returned 1 instead of one of [0]
 /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0]
 /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: /usr/sbin/foreman-rake db:seed returned 1 instead of one of [0]
Installing             Done                                               [100%] [..................................................................]
  Something went wrong! Check the log for ERROR-level output
  The full log is at /var/log/foreman-installer/satellite.log
Upgrade Step: restart_services...
Upgrade Step: db_seed...
Upgrade step db_seed failed. Check logs for more information.


but when I ran db:migrate manually, got:

~]# /usr/sbin/foreman-rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20150612135546 CreateHostStatus: migrating =================================
-- create_table(:host_status)
   -> 0.0280s
-- add_index(:host_status, :host_id)
   -> 0.0044s
-- add_foreign_key("host_status", "hosts", {:name=>"host_status_hosts_host_id_fk", :column=>"host_id"})
   -> 0.0035s
-- add_column(:hosts, :global_status, :integer, {:default=>0, :null=>false})
   -> 0.0409s
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `importing_facts=' for #<Host::Managed:0x00000008cf1e78>/opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/attribute_methods.rb:435:in `method_missing'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/attribute_methods.rb:208:in `method_missing'
/usr/share/foreman/db/migrate/20150612135546_create_host_status.rb:19:in `ensure in block in up'
/usr/share/foreman/db/migrate/20150612135546_create_host_status.rb:19:in `block in up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block (2 levels) in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:52:in `block in find_each'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:125:in `find_in_batches'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/relation/batches.rb:51:in `find_each'
/usr/share/foreman/db/migrate/20150612135546_create_host_status.rb:14:in `up'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:598:in `exec_migration'
/opt/rh/rh-ror41/root/usr/share/gems/gems/activerecord-4.1.5/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'



Version-Release number of selected component (if applicable):
Upgrade [6.1.9 -> 6.2 snap14]  

How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:
db:migrate failed due to error: undefined method `importing_facts=' for #<Host::Managed:0x00000008cf1e78>


Expected results:


Additional info:

Comment 1 Sachin Ghai 2016-06-02 07:53:07 UTC
Created attachment 1163940 [details]
complete_execption

Comment 2 Sachin Ghai 2016-06-02 09:20:32 UTC
Created attachment 1164005 [details]
foreman-debug

Comment 3 Marek Hulan 2016-06-02 09:42:43 UTC
Thanks for reporting, I believe it's already tracked as https://bugzilla.redhat.com/show_bug.cgi?id=1341860 so I'm closing as a duplicate.

*** This bug has been marked as a duplicate of bug 1341860 ***