Bug 1646988

Summary: Satellite upgrade from 6.4 to 6.5 failed at db:migrate
Product: Red Hat Satellite Reporter: Omkar Khatavkar <okhatavk>
Component: Sync PlansAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: Nikhil Kathole <nkathole>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: egolov, inecas, mbacovsk, nkathole
Target Milestone: 6.5.0Keywords: PrioBumpQA, Regression, Triaged, Upgrades
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: tfm-rubygem-katello-3.9.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:38:40 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: 1653153    
Attachments:
Description Flags
Attached Log file none

Description Omkar Khatavkar 2018-11-06 13:16:11 UTC
Created attachment 1502447 [details]
Attached Log file

Description of problem:
Satellite upgrade from 6.4 to 6.5 failed on Sync Plan

Version-Release number of selected component (if applicable):


How reproducible:
always 

Steps to Reproduce:
1. Make sure you have 6.4 satellite installed 
2.Create Sync Plans
3.Assigned them to products 
4.Upgrade Satellite from 6.4 to 6.5 

Actual results:
Upgrade should work

Expected results:
upgrade failed on the step of sync plan migration

Additional info:
added logs

Minilog :
StandardError: An error has occurred, this and all later migrations canceled:
 
undefined method `cron_expression' for #<Katello::SyncPlan:0x0000000010102808>
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activemodel-5.2.1/lib/active_model/attribute_methods.rb:430:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.9.0.rc2/app/models/katello/sync_plan.rb:70:in `associate_recurring_logic'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.9.0.rc2/db/migrate/20180814202747_add_recurring_logic_to_sync_plan.rb:7:in `block (2 levels) in change'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:100:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:106:in `as_anonymous_admin'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.9.0.rc2/db/migrate/20180814202747_add_recurring_logic_to_sync_plan.rb:6:in `block in change'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'


Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20180814202747 AddRecurringLogicToSyncPlan: migrating ======================
-- add_column(:katello_sync_plans, :foreman_tasks_recurring_logic_id, :integer)
   -> 0.0020s
-- add_foreign_key(:katello_sync_plans, :foreman_tasks_recurring_logics, {:name=>"katello_sync_plan_foreman_tasks_recurring_logic_fk", :column=>"foreman_tasks_recurring_logic_id"})
   -> 0.0044s
foreman-rake db:migrate failed! Check the output for error!

Comment 2 Omkar Khatavkar 2018-11-06 13:37:22 UTC
correcting my mistake on results.

Actual results:
upgrade failed on the step of sync plan migration

Expected results:
Upgrade should work

Comment 4 Samir Jha 2018-11-06 15:38:41 UTC
Created redmine issue http://projects.theforeman.org/issues/25399 from this bug

Comment 5 Satellite Program 2018-11-07 17:01:07 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25399 has been resolved.

Comment 7 Nikhil Kathole 2018-12-26 09:00:14 UTC
VERIFIED

Version tested:
6.4 to 6.5 snap 9 upgrade

/usr/share/candlepin/cpdb --update --database '//localhost/candlepin' --user 'candlepin' --password '2krL9GNFQE46CrzUkjaZM9iAs4copVsq' finished successfully!
 Upgrade Step: migrate_foreman...

 /usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
 /usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here

 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/content_facet_host_extensions.rb:7: warning: already initialized constant Katello::Concerns::ContentFacetHostExtensions::ERRATA_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/content_facet_host_extensions.rb:7: warning: previous definition of ERRATA_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/content_facet_host_extensions.rb:14: warning: already initialized constant Katello::Concerns::ContentFacetHostExtensions::TRACE_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/content_facet_host_extensions.rb:14: warning: previous definition of TRACE_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:13: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::SUBSCRIPTION_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:13: warning: previous definition of SUBSCRIPTION_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:21: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::SLA_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:21: warning: previous definition of SLA_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:26: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::USAGE_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:26: warning: previous definition of USAGE_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:31: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::ROLE_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:31: warning: previous definition of ROLE_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:36: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::ADDONS_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:36: warning: previous definition of ADDONS_STATUS_MAP was here
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:41: warning: already initialized constant Katello::Concerns::SubscriptionFacetHostExtensions::PURPOSE_STATUS_MAP
 /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.4/app/models/katello/concerns/subscription_facet_host_extensions.rb:41: warning: previous definition of PURPOSE_STATUS_MAP was here

 foreman-rake db:migrate finished successfully!
 Upgrade Step: Running installer...

Comment 10 errata-xmlrpc 2019-05-14 12:38:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:1222