Bug 1317261

Summary: Migration of SCAP from Sat 6.1 to Sat 6.2
Product: Red Hat Satellite Reporter: Shlomi Zadok <szadok>
Component: SCAP PluginAssignee: Shlomi Zadok <szadok>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.2.0CC: bbuckingham, cwelton, ohadlevy, sthirugn
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/14477
Whiteboard:
Fixed In Version: rubygem-foreman_openscap-0.5.3.5-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 11:43:15 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:

Description Shlomi Zadok 2016-03-13 13:26:39 UTC
Description of problem:
In 6.1, all the ARF reports were saved as XML in the Foreman database. That caused us a lot of pain (future pain, even...) so during refactoring of foreman_openscap we did two things:
1. Move all OpenSCAP processing to the capsule
2. Save ARF reports as files in the capsule and send a report (similar to Puppet reports) back to Foreman.
This is how it is intended to play in 6.2

The problem: when upgrading from old OpenSCAP to the new one, the migration is taking the XML files from database and recreates them as foreman_openscap reports. Then we drop the tables with the XML files. That may raise an issue with existing users, who will not have the original XML file.

Proposed solution:
5. convert the migration process to an external task (rake task), similar to the existing migration logic and:
a. check if a proxy is already installed and running, then move the reports one at a time (so you can handle failure if someone stopped the process in the middle or something).
b. delete the table only if its empty (maybe even part of the rake task so when its done it can remove the table).
c. have the ability to execute the data migration script manually (very similar to how trends data was converted between 6.1 to 6.2) and then it becomes a documentation section?

Comment 1 Shlomi Zadok 2016-04-05 12:53:12 UTC
Created redmine issue http://projects.theforeman.org/issues/14477 from this bug

Comment 5 Kedar Bidarkar 2016-07-22 14:04:43 UTC
Migration of SCAP from Sat6.1 to Sat6.2 requires 2 steps, for which we need release notes and a bug is raised for it, https://bugzilla.redhat.com/show_bug.cgi?id=1358309

1) Also for the "View full report" and "Download XML in bzip" to be possible, we need to assign "oscap proxy" to the host. So for that to be done for multiple hosts, I did the following:

a) Assign the "oscap-proxy" to host_group.
b) And make sure all the hosts are setup with a "oscap proxy", even for the older hosts and new hosts that would be created.
c) One way which I tried to do is to search for hosts via "content_source" and "os_major" , and unassign and reassign the host-group for the hosts so that the oscap-proxy is set for all the hosts in one go.

2) Ran this command, foreman-rake foreman_openscap:migrate[1]

3) Tested for the following compliance reports, for "View full reports" and "download xml in bzip format" and it works fine.

a) from managed hosts of sat6.1 migrated to sat6.2
b) from unmanaged hosts of sat6.1 migrated to sat6.2
c) from newly provisioned hosts of sat6.2 after upgrade.


VERIFIED with sat62-snap21.1(GA)

Comment 6 Bryan Kearney 2016-07-27 11:43:15 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/RHBA-2016:1501