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.
DescriptionAndreas Bleischwitz
2018-02-21 15:36:45 UTC
Description of problem:
During the upgrade of Satellite the migration of the database fails and the upgrade is stopped. Any re-start of the upgrade fails with the same error
Version-Release number of selected component (if applicable):
# rpm -q satellite
satellite-6.3.0-23.0.el7sat.noarch
How reproducible:
Update from satellite-6.2.14-4.0.el7sat.noarch.
Actual results:
[ INFO 2018-02-21 16:16:12 main] Upgrade Step: migrate_foreman...
[DEBUG 2018-02-21 16:16:39 main] rake aborted!
[DEBUG 2018-02-21 16:16:39 main] StandardError: An error has occurred, this and all later migrations canceled:
[DEBUG 2018-02-21 16:16:39 main]
[DEBUG 2018-02-21 16:16:39 main] Failed to destroy the record/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/persistence.rb:185:in `destroy!'
[DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:5:in `map'
[DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:5:in `block in up'
[DEBUG 2018-02-21 16:16:39 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/batches.rb:124:in `find_in_batches'
[DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:4:in `up'
[DEBUG 2018-02-21 16:16:39 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration'
Expected results:
Upgrade finishes without error.
Additional info:
I fixed this issue by removing the "!" from /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:
--- 20171011134112_remove_arf_reports_without_policy.rb-old 2018-02-21 16:19:53.259631092 +0100
+++ 20171011134112_remove_arf_reports_without_policy.rb 2018-02-21 16:22:27.050573034 +0100
@@ -2,7 +2,7 @@
def up
ids_to_keep = ForemanOpenscap::ArfReport.unscoped.all.joins(:policy_arf_report).pluck(:id)
ForemanOpenscap::ArfReport.unscoped.where.not(:id => ids_to_keep).find_in_batches do |batch|
- batch.map(&:destroy!)
+ batch.map(&:destroy)
end
end
end
Andreas, do you have the *full* log of the upgrade available?
ActiveRecord::Persistence.destroy! raises an error if the destroy did not work out, ActiveRecord::Persistence.destroy does not, so you basically have hidden the problem ;)
Comment 2Andreas Bleischwitz
2018-02-21 17:04:50 UTC
Build: Satellite 6.3.1 snap1
Reproducer steps:
1) Have a scap policy
2) Create a report from the policy
3) delete the policy
4) Upgrade your 6.2.14 to 6.3
The upgrade from 6.2.14 to 6.3 was successfully with the orphan arf report in it
The upgrade successfully remove the orphan arf reports
[qe-sat6-] out:
[qe-sat6-] out: == 20171011134112 RemoveArfReportsWithoutPolicy: migrating ====================
[qe-sat6-] out: == 20171011134112 RemoveArfReportsWithoutPolicy: migrated (0.0839s) ===========
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/RHBA-2018:1126
Description of problem: During the upgrade of Satellite the migration of the database fails and the upgrade is stopped. Any re-start of the upgrade fails with the same error Version-Release number of selected component (if applicable): # rpm -q satellite satellite-6.3.0-23.0.el7sat.noarch How reproducible: Update from satellite-6.2.14-4.0.el7sat.noarch. Actual results: [ INFO 2018-02-21 16:16:12 main] Upgrade Step: migrate_foreman... [DEBUG 2018-02-21 16:16:39 main] rake aborted! [DEBUG 2018-02-21 16:16:39 main] StandardError: An error has occurred, this and all later migrations canceled: [DEBUG 2018-02-21 16:16:39 main] [DEBUG 2018-02-21 16:16:39 main] Failed to destroy the record/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/persistence.rb:185:in `destroy!' [DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:5:in `map' [DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:5:in `block in up' [DEBUG 2018-02-21 16:16:39 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/batches.rb:124:in `find_in_batches' [DEBUG 2018-02-21 16:16:39 main] /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb:4:in `up' [DEBUG 2018-02-21 16:16:39 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/migration.rb:611:in `exec_migration' Expected results: Upgrade finishes without error. Additional info: I fixed this issue by removing the "!" from /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-0.7.11/db/migrate/20171011134112_remove_arf_reports_without_policy.rb: --- 20171011134112_remove_arf_reports_without_policy.rb-old 2018-02-21 16:19:53.259631092 +0100 +++ 20171011134112_remove_arf_reports_without_policy.rb 2018-02-21 16:22:27.050573034 +0100 @@ -2,7 +2,7 @@ def up ids_to_keep = ForemanOpenscap::ArfReport.unscoped.all.joins(:policy_arf_report).pluck(:id) ForemanOpenscap::ArfReport.unscoped.where.not(:id => ids_to_keep).find_in_batches do |batch| - batch.map(&:destroy!) + batch.map(&:destroy) end end end