Bug 1257603 - Running foreman-rake db:seed multiple times results in duplicate OpenSCAP content entries
Running foreman-rake db:seed multiple times results in duplicate OpenSCAP con...
Status: CLOSED ERRATA
Product: Red Hat Satellite 6
Classification: Red Hat
Component: SCAP Plugin (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity medium (vote)
: GA
: --
Assigned To: Shlomi Zadok
Kedar Bidarkar
http://projects.theforeman.org/issues...
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 08:30 EDT by Rich Jerrido
Modified: 2016-07-27 05:18 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-27 05:18:10 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 9950 None None None 2016-04-22 12:39 EDT

  None (edit)
Description Rich Jerrido 2015-08-27 08:30:43 EDT
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 13:37:03 EDT
Created redmine issue http://projects.theforeman.org/issues/11606 from this bug
Comment 2 Shlomi Zadok 2015-09-10 01:24:23 EDT
Upstream fixed with https://github.com/theforeman/foreman_openscap/pull/112
Comment 6 Kedar Bidarkar 2015-10-08 10:09:54 EDT
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 03:57:24 EDT
Not sure I follow, Does it create *new* scap content each time you run? Or between upgrades?
Comment 8 Kedar Bidarkar 2015-10-12 16:45:02 EDT
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 16:49:17 EDT
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 08:58:13 EDT
Connecting redmine issue http://projects.theforeman.org/issues/9950 from this bug
Comment 13 Bryan Kearney 2016-01-04 16:33:52 EST
Upstream bug assigned to szadok@redhat.com
Comment 14 Shlomi Zadok 2016-03-10 04:04:33 EST
Should be solved on 6.2
Committed as https://github.com/theforeman/foreman_openscap/commit/15a507db1e66a2cc873adad9c16ca6ef77a2d359
Comment 16 Kedar Bidarkar 2016-05-20 09:21:44 EDT
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 09:30:24 EDT
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 05:18:10 EDT
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.