[Satellite 6] Unable to upload default SCAP content
Environment
Red Hat Satellite 6.3.x.
Issue
foreman-rake foreman_openscap:bulk_upload:default
## SCAP content is invalid: No Capsule with OpenSCAP feature was found. ##
## SCAP content is invalid: No Capsule with OpenSCAP feature was found. ##
## SCAP content is invalid: No Capsule with OpenSCAP feature was found. ##
## SCAP content is invalid: No Capsule with OpenSCAP feature was found. ##
Resolution
After fixing the db by removing duplicate roles, re-run satellite-installer -s satellite --upgrade to enable the OpenSCAP feature.
Steps to remove duplicate roles:
- Backup your Satellite first then run the following commands:
su postgres
psql foreman
update roles set origin = '' where id in (22, 23, 25, 26); *# need to get the duplicate role ids
- Go to web UI to delete these duplicate roles
For more KB articles/solutions related to Red Hat Satellite 6.x OpenSCAP Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x OpenSCAP Issues
Root Cause
satellite-installer -S satellite --upgrade was not run successfully as it failed on migrating db.
# foreman-rake db:seed --trace
** Invoke db:seed (first_time)
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:abort_if_pending_migrations
Seeding /usr/share/foreman/db/seeds.d/02-partition_tables_list.rb
Seeding /usr/share/foreman/db/seeds.d/02-permissions_list.rb
Seeding /usr/share/foreman/db/seeds.d/02-provisioning_templates_list.rb
Seeding /usr/share/foreman/db/seeds.d/02-roles_list.rb
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-data.rb
Seeding /usr/share/foreman/db/seeds.d/07-provisioning_templates.rb
Seeding /usr/share/foreman/db/seeds.d/08-data.rb
Seeding /usr/share/foreman/db/seeds.d/08-partition_tables.rb
Seeding /usr/share/foreman/db/seeds.d/10-installation_media.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/101-locations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/102-organizations.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/103-provisioning_templates.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/104-proxy.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/106-mail_notifications.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/107-enable_dynflow.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.4.5.64.2/db/seeds.d/108-subcription-bookmarks.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 /usr/share/foreman/db/seeds.d/17-notification_blueprints.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/foreman-tasks-0.9.6.4/db/seeds.d/20-foreman_tasks_permissions.rb
Seeding /opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.13/db/seeds.d/200-update-insights-roles.rb
rake aborted!
ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:79:in `raise_record_invalid'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
/usr/share/foreman/app/models/role.rb:201:in `add_permissions!'
/opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.13/db/seeds.d/200-update-insights-roles.rb:7:in `block (2 levels) in <top (required)>'
/usr/share/foreman/app/models/role.rb:83:in `ignore_locking'
/opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.13/db/seeds.d/200-update-insights-roles.rb:5:in `block in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.4.1/lib/audited/auditor.rb:283:in `without_auditing'
/opt/theforeman/tfm/root/usr/share/gems/gems/redhat_access-2.0.13/db/seeds.d/200-update-insights-roles.rb:1:in `<top (required)>'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/usr/share/foreman/db/seeds.rb:38:in `block in <top (required)>'
/usr/share/foreman/db/seeds.rb:36:in `each'
/usr/share/foreman/db/seeds.rb:36:in `<top (required)>'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `block in load'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:240:in `load_dependency'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activesupport-4.2.6/lib/active_support/dependencies.rb:268:in `load'
/opt/rh/rh-ror42/root/usr/share/gems/gems/railties-4.2.6/lib/rails/engine.rb:547:in `load_seed'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:250:in `load_seed'
/opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:183:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby23/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/rh/rh-ruby23/root/usr/share/gems/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `load'
/opt/rh/rh-ruby23/root/usr/bin/rake:23:in `<main>'
Diagnostic Steps
/var/log/foreman-installer/satellite.log, shows error below:
[ INFO 2018-06-08 07:10:52 main] Upgrade Step: db_seed...
[DEBUG 2018-06-08 07:11:06 main] rake aborted!
[DEBUG 2018-06-08 07:11:06 main] ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:79:in `raise_record_invalid'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/validations.rb:43:in `save!'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/attribute_methods/dirty.rb:29:in `save!'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `block in save!'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:351:in `block in with_transaction_returning_status'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:220:in `transaction'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:348:in `with_transaction_returning_status'
[DEBUG 2018-06-08 07:11:06 main] /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/transactions.rb:291:in `save!'
//usr/share/foreman/app/models/role.rb:201:in `add_permissions!'
This error indicates that there are multiple roles in the foreman db:
foreman=# select * from roles;
id | name | builtin | description | origin | cloned_from_id
----+--------------------------+---------+--------------------------------+----------------------------+----------------
1 | Manager | 0 | | foreman |
2 | Organization admin | 0 | | foreman |
3 | Edit partition tables | 0 | | foreman |
4 | View hosts | 0 | | foreman |
5 | Edit hosts | 0 | | foreman |
6 | Viewer | 0 | | foreman |
7 | Site manager | 0 | | foreman |
8 | Default role | 2 | | foreman |
9 | Tasks Manager | 0 | | foreman-tasks |
10 | Tasks Reader | 0 | | foreman-tasks |
11 | Remote Execution User | 0 | | foreman_remote_execution |
12 | Remote Execution Manager | 0 | | foreman_remote_execution |
15 | Boot disk access | 0 | | foreman_bootdisk |
16 | Virt-who Reporter | 0 | | foreman_virt_who_configure |
17 | Virt-who Manager | 0 | | foreman_virt_who_configure |
18 | Virt-who Viewer | 0 | | foreman_virt_who_configure |
19 | Red Hat Access Logs | 0 | | redhat_access |
20 | Red Hat Access Logs | 0 | | redhat_access |
21 | Access Insights Viewer | 0 | | redhat_access | <====== multiple entries
22 | Access Insights Viewer | 0 | | redhat_access |
23 | Access Insights Viewer | 0 | | redhat_access |
24 | Access Insights Admin | 0 | | redhat_access | <====== multiple entries
25 | Access Insights Admin | 0 | | redhat_access |
26 | Access Insights Admin | 0 | | redhat_access |
27 | Compliance viewer | 0 | | foreman_openscap |
28 | Compliance manager | 0 | | foreman_openscap |
29 | Create ARF report | 0 | | foreman_openscap |
13 | Discovery Reader | 0 | Discovery plugin built-in role | discovery |
14 | Discovery Manager | 0 | Discovery plugin built-in role | discovery |
(29 rows)
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.