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 1863597 - Inventory plug-in configuration(--enable-foreman-plugin-inventory-upload) makes DB inconsistent.
Summary: Inventory plug-in configuration(--enable-foreman-plugin-inventory-upload) mak...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Installation
Version: 6.7.0
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: 6.10.0
Assignee: satellite6-bugs
QA Contact: Devendra Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-03 16:50 UTC by Amar Huchchanavar
Modified: 2024-12-20 19:11 UTC (History)
16 users (show)

Fixed In Version: foreman-installer-2.0.0
Doc Type: Known Issue
Doc Text:
Inventory plug-in configuration(--enable-foreman-plugin-inventory-upload) makes DB inconsistent
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5418431 0 None None None 2020-09-21 06:13:41 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:35 UTC

Description Amar Huchchanavar 2020-08-03 16:50:36 UTC
Description of problem:

https://access.redhat.com/documentation/en-us/red_hat_insights/2020-04/html/remediating_issues_across_your_red_hat_satellite_infrastructure_using_red_hat_insights/configuring-your-satellite-infrastructure-to-communicate-with-insights

# satellite-installer \
--enable-foreman-plugin-inventory-upload \
--foreman-proxy-plugin-remote-execution-ssh-install-key true

This command causing the below issue.

Getting below error while accessing - Hosts -All Hosts.
~~~
Oops, we're sorry but something went wrong PG::UndefinedTable: ERROR: relation "insights_hits" does not exist LINE 8: WHERE a.attrelid = '"insights_hits"'::regclas... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"insights_hits"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
~~~

Version-Release number of selected component (if applicable):
Satellite 6.7

How reproducible:
Not Always

Steps to Reproduce:
1. Take Satellite 6.7
2. Try to configure inventory upload plugin
# satellite-installer \
--enable-foreman-plugin-inventory-upload \
--foreman-proxy-plugin-remote-execution-ssh-install-key true


Actual results:
ActionView::Template::Error
PG::UndefinedTable: ERROR: relation "insights_hits" does not exist LINE 8: WHERE a.attrelid = '"insights_hits"'::regclas... ^ : SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_type t ON a.atttypid = t.oid LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation WHERE a.attrelid = '"insights_hits"'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `async_exec'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `block (2 levels) in query'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_
.
.
.
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
/usr/share/gems/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'
/opt/theforeman/tfm/root/usr/share/gems/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'

Expected results:
It should not throw that error.


Additional info:

Workaround Fix:
 # foreman-rake db:migrate --trace

Comment 4 jaudet 2020-08-11 15:39:28 UTC
I have a Satellite 6.7.2 and successfully executed `satellite-installer ...`, without hitting the error described above. However, when registering a client to the satellite, I hit a similar error:

[root@dhcp-2-168 ~]# subscription-manager register --org="Default_Organization" --environment="Library"
Registering to: my-sat.example.com:443/rhsm
Username: admin
Password: 
HTTP error (500 - Internal Server Error): PG::UndefinedTable: ERROR:  relation "insights_facets" does not exist
LINE 8:                WHERE a.attrelid = '"insights_facets"'::regcl...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
                     c.collname, col_description(a.attrelid, a.attnum) AS comment
                FROM pg_attribute a
                LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum
                LEFT JOIN pg_type t ON a.atttypid = t.oid
                LEFT JOIN pg_collation c ON a.attcollation = c.oid AND a.attcollation <> t.typcollation
               WHERE a.attrelid = '"insights_facets"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum

Executing the workaround (`foreman-rake db:migrate --trace`) resolved the issue.

Comment 5 Mike McCune 2020-08-11 17:49:49 UTC
** WORKAROUND **

When installing the plugin, add the --upgrade flag:

satellite-installer \
--enable-foreman-plugin-inventory-upload \
--foreman-proxy-plugin-remote-execution-ssh-install-key true \
--upgrade

Will work to get this into the documentation as the technical solution to this will land in 6.8

Comment 6 Mike McCune 2020-08-11 17:53:13 UTC
Docs bug filed:

https://bugzilla.redhat.com/show_bug.cgi?id=1868118

Comment 9 Zach Huntington-Meath 2020-12-07 19:18:18 UTC
https://github.com/theforeman/puppet-foreman/commit/9c1787ad19b2cae407b25958095ecbf78757a959

Putting this here for now as it is the fix for this issue. I put this here because it failed trying to link this BZ to jira when I gave it this commit to link above.

Comment 10 Ewoud Kohl van Wijngaarden 2020-12-07 20:21:50 UTC
This should be part of foreman-installer 2.0.0 which was included in 6.8. At least in upstream it wasn't a safe thing to cherry pick due to db:migrate RPM post scripts. It was a combination of packaging and installer that allowed this to be fixed. I'm hesitant to picking this to 6.7.

Comment 11 Mike McCune 2020-12-08 18:18:18 UTC
This is a 6.7 bug only as it is solved in 6.8 with the installer. Adjusting bug to reflect this.

Comment 15 Devendra Singh 2021-07-08 09:28:15 UTC
Verified on 6.10 Snap7

Verification points:

1- Ran the installer command with "enable-foreman-plugin-rh-cloud" and "foreman-proxy-plugin-remote-execution-ssh-install-key", I didnt see any issue with that.

# satellite-installer --enable-foreman-plugin-rh-cloud --foreman-proxy-plugin-remote-execution-ssh-install-key true
2021-07-07 13:45:19 [NOTICE] [root] Loading installer configuration. This will take some time.
2021-07-07 13:45:26 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2021-07-07 13:45:26 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
......................
......................
Candlepin orphaned consumers: []
  Success!
2- Verified the enabled settings in installer helper

# satellite-installer --help|grep -A1 -e enable-foreman-plugin-rh-cloud -e foreman-proxy-plugin-remote-execution-ssh-install-key
    --[no-]enable-foreman-plugin-rh-cloud Enable 'foreman_plugin_rh_cloud' puppet module (default: true)

    --foreman-proxy-plugin-remote-execution-ssh-install-key  Automatically install generated SSH key to root authorized keys
                                  which allows managing this host through Remote Execution (current: true)



3- Register the client with satellite and it works.

4- Verified the fixed in a package.

# rpm -qa|grep foreman-installer-2
foreman-installer-2.5.1-1.el7sat.noarch

Comment 19 errata-xmlrpc 2021-11-16 14:09:27 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 (Moderate: Satellite 6.10 Release), 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/RHSA-2021:4702


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