Bug 1257603 - Running foreman-rake db:seed multiple times results in duplicate OpenSCAP content entries
Summary: Running foreman-rake db:seed multiple times results in duplicate OpenSCAP con...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: SCAP Plugin
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: Unspecified
Assignee: Shlomi Zadok
QA Contact: Kedar Bidarkar
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-27 12:30 UTC by Rich Jerrido
Modified: 2019-09-26 14:34 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 09:18:10 UTC
Target Upstream Version:


Attachments (Terms of Use)
Image illustrating the duplicate content (46.89 KB, image/png)
2015-08-27 12:30 UTC, Rich Jerrido
no flags Details


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 9950 None None None 2016-04-22 16:39:03 UTC
Red Hat Product Errata RHBA-2016:1501 normal SHIPPED_LIVE Red Hat Satellite 6.2 Capsule and Server 2016-07-27 12:28:58 UTC

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@redhat.com

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


Note You need to log in before you can comment on or make changes to this bug.