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 1257603

Summary: Running foreman-rake db:seed multiple times results in duplicate OpenSCAP content entries
Product: Red Hat Satellite Reporter: Rich Jerrido <rjerrido>
Component: SCAP PluginAssignee: Shlomi Zadok <szadok>
Status: CLOSED ERRATA QA Contact: Kedar Bidarkar <kbidarka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1.0CC: bbuckingham, bkearney, cwelton, ehelms, kbidarka, mmccune, szadok
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/9950
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-27 09:18:10 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:
Attachments:
Description Flags
Image illustrating the duplicate content none

Description Rich Jerrido 2015-08-27 12:30:43 UTC
Created attachment 1067724 [details]
Image illustrating the duplicate content

Description of problem:

Running foreman-rake db:seed multiple times results in duplicate OpenSCAP content entries (for Red Hat default content) on the Hosts->SCAP Contents page 




Version-Release number of selected component (if applicable):
openscap-1.2.4-1.el7sat.x86_64
openscap-scanner-1.2.4-1.el7sat.x86_64
puppet-foreman_scap_client-0.3.3-9.el7sat.noarch
puppetlabs-stdlib-4.2.1-1.20140510git08b00d9.el7sat.noarch
ruby193-rubygem-foreman_openscap-0.3.2.10-1.el7sat.noarch
ruby193-rubygem-openscap-0.4.2-2.el7sat.noarch
ruby193-rubygem-scaptimony-0.3.0.1-1.el7sat.noarch
rubygem-smart_proxy_openscap-0.3.0.9-1.el7sat.noarch
scap-security-guide-0.1.19-2.el7.noarch


How reproducible:
100%

Steps to Reproduce:
1. Install SCAP components (yum install ruby193-rubygem-foreman_openscap rubygem-smart_proxy_openscap
)
2 run 'foreman-rake db:seed' at the CLI.
3.

Actual results:

multiple entries shown on the Hosts->SCAP Contents page. If db:seed is run 6 times, there will be 6 entries on the page (for example)

Expected results:

A single entry for RHEL 6 & RHEL 7

Additional info:

Comment 1 Bryan Kearney 2015-08-28 17:37:03 UTC
Created redmine issue http://projects.theforeman.org/issues/11606 from this bug

Comment 2 Shlomi Zadok 2015-09-10 05:24:23 UTC
Upstream fixed with https://github.com/theforeman/foreman_openscap/pull/112

Comment 6 Kedar Bidarkar 2015-10-08 14:09:54 UTC
From rhel71 run:

[root@123 abc]# foreman-rake db:seed
Seeding /usr/share/foreman/db/seeds.d/03-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/03-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/03-roles.rb
Seeding /usr/share/foreman/db/seeds.d/04-admin.rb
Seeding /usr/share/foreman/db/seeds.d/05-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/06-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/07-config_templates.rb
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /usr/share/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/15-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/16-mail_notifications.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman-tasks-0.6.15.7/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-4.0.2.13/db/seeds.d/50-bootdisk_templates.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_discovery-2.0.0.19/db/seeds.d/60_discovery_proxy_feature.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman-tasks-0.6.15.7/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_openscap-0.3.2.10/db/seeds.d/openscap_feature.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_openscap-0.3.2.10/db/seeds.d/openscap_scap_default.rb
Saved /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml as Red Hat rhel6 default content
Saved /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml as Red Hat rhel7 default content
All seed files executed


From rhel67 run 

[root@123 abc]# foreman-rake db:seed
Seeding /usr/share/foreman/db/seeds.d/03-auth_sources.rb
Seeding /usr/share/foreman/db/seeds.d/03-permissions.rb
Seeding /usr/share/foreman/db/seeds.d/03-roles.rb
Seeding /usr/share/foreman/db/seeds.d/04-admin.rb
Seeding /usr/share/foreman/db/seeds.d/05-taxonomies.rb
Seeding /usr/share/foreman/db/seeds.d/06-architectures.rb
Seeding /usr/share/foreman/db/seeds.d/07-config_templates.rb
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /usr/share/foreman/db/seeds.d/11-smart_proxy_features.rb
Seeding /usr/share/foreman/db/seeds.d/13-compute_profiles.rb
Seeding /usr/share/foreman/db/seeds.d/15-bookmarks.rb
Seeding /usr/share/foreman/db/seeds.d/16-mail_notifications.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman-tasks-0.6.15.7/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_bootdisk-4.0.2.13/db/seeds.d/50-bootdisk_templates.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_discovery-2.0.0.19/db/seeds.d/60_discovery_proxy_feature.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman-tasks-0.6.15.7/db/seeds.d/61-foreman_tasks_bookmarks.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_openscap-0.3.2.10/db/seeds.d/openscap_feature.rb
Seeding /opt/rh/ruby193/root/usr/share/gems/gems/foreman_openscap-0.3.2.10/db/seeds.d/openscap_scap_default.rb
Saved /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml as Red Hat rhel6 default content
Saved /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml as Red Hat rhel7 default content
All seed files executed





We can still see multiple entries in the UI when we run 'foreman-rake db:seed'

Comment 7 Shlomi Zadok 2015-10-11 07:57:24 UTC
Not sure I follow, Does it create *new* scap content each time you run? Or between upgrades?

Comment 8 Kedar Bidarkar 2015-10-12 20:45:02 UTC
Yes, this was when directly running the command 'foreman-rake db:seed' as per the initial bug report. We do see multiple entries. I did not try any upgrades on this setup.

Comment 9 Mike McCune 2015-10-12 20:49:17 UTC
Each time you run foreman-rake db:seed you get new entries in the ui, see the screenshot here:

https://mmccune.fedorapeople.org/scratch/scap-content-migrate.png

I'm moving this to 6.1.4 as we are out of time in 6.1.3

Comment 11 Bryan Kearney 2015-10-15 12:58:13 UTC
Connecting redmine issue http://projects.theforeman.org/issues/9950 from this bug

Comment 13 Bryan Kearney 2016-01-04 21:33:52 UTC
Upstream bug assigned to szadok

Comment 14 Shlomi Zadok 2016-03-10 09:04:33 UTC
Should be solved on 6.2
Committed as https://github.com/theforeman/foreman_openscap/commit/15a507db1e66a2cc873adad9c16ca6ef77a2d359

Comment 16 Kedar Bidarkar 2016-05-20 13:21:44 UTC
For Satellite 6.1 the command was :

"foreman-rake db:seed"

For Satellite 6.2 the command is:

"foreman-rake foreman_openscap:bulk_upload:default"

Actually not applicable for Sat6.2 but,
Will still test for Satellite6.2 , by running the command twice, "foreman-rake foreman_openscap:bulk_upload:default".

Comment 17 Kedar Bidarkar 2016-05-20 13:30:24 UTC
VERIFIED with sat62-snap12.1

This issue is no longer seen with oscap content.

running the sat62 command twice does not duplicate them.

Comment 19 errata-xmlrpc 2016-07-27 09:18:10 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