Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1340614

Summary: Upgrades: db_migrate fails with undefined method `org' for #<MigrateContentHosts (rhel6)
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: UpgradesAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2.0CC: bbuckingham
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-05-31 12:30:04 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    

Description Lukas Pramuk 2016-05-28 21:18:01 UTC
Description of problem:
Upgrades: db_migrate fails with undefined method `org' for #<MigrateContentHosts::Host:0x00000002e3abc8>/opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/attribute_methods.rb:435:in `method_missing'

Version-Release number of selected component (if applicable):
Sat6.2.0-Snap13.1

How reproducible:
with populated server

Steps to Reproduce:
# satellite-installer -S satellite --upgrade
Upgrading...
Upgrade Step: stop_services...
Upgrade Step: start_databases...
Upgrade Step: update_http_conf...
Upgrade Step: migrate_pulp...
Upgrade Step: fix_pulp_httpd_conf...
Upgrade Step: start_httpd...
Upgrade Step: start_qpidd...
Upgrade Step: start_pulp...
Upgrade Step: migrate_candlepin...
Upgrade Step: start_tomcat...
Upgrade Step: fix_katello_settings_file...
Upgrade Step: migrate_foreman...
Upgrade Step: migrate_gutterball...
Upgrade Step: remove_nodes_distributors...
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.
/usr/lib/ruby/gems/1.8/gems/kafo-0.7.3/lib/kafo/logger.rb:108:in `error': wrong number of arguments (57 for 1) (ArgumentError)

Actual results:
db_migrate fails

Expected results:
db_migrate succeeds

Comment 1 Lukas Pramuk 2016-05-28 21:20:46 UTC
/var/log/foreman-installer/satellite.log:
...
[ INFO 2016-05-27 19:47:26 main] Upgrade Step: migrate_foreman...
[DEBUG 2016-05-27 19:47:52 main] true

[ERROR 2016-05-27 19:48:19 main] rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `org' for #<MigrateContentHosts::Host:0x0000000d9901d0>/opt/rh/rh-ror41/root/usr/share/gems/gems/activemodel-4.1.5/lib/active_model/a
ttribute_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'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.35/db/migrate/20150930183738_migrate_content_hosts.rb:328:in `block in up'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.35/db/migrate/20150930183738_migrate_content_hosts.rb:304:in `each'
...
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20150930183738 MigrateContentHosts: migrating ==============================

[DEBUG 2016-05-27 19:48:42 main] false

[ INFO 2016-05-27 19:48:42 main] Upgrade Step: migrate_gutterball...
...

Comment 2 Lukas Pramuk 2016-05-28 21:27:02 UTC
db_migrate.log:
...
== 20150114210634 RenameScaptimonyArfReportRawRaw: migrating ==================
-- rename_column(:scaptimony_arf_report_raws, :raw, :bzip_data)rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `org' for #<MigrateContentHosts::Host:0x000000021dd4e8>/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'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.0.0.35/db/migrate/20150930183738_migrate_content_hosts.rb:328:in `block in up'
...
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

   -> 0.0047s
== 20150114210634 RenameScaptimonyArfReportRawRaw: migrated (0.0049s) =========
...
== 20150930183738 MigrateContentHosts: migrating ==============================
(END)

Comment 3 Lukas Pramuk 2016-05-28 21:32:30 UTC
# foreman-rake db:migrate
== 20150930183738 MigrateContentHosts: migrating ==============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `org' for #<MigrateContentHosts::Host:0x007fc5c809ac00>/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'
...