This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 1772702 - Unable to sync the ansible inventory with filters on ansible role.
Summary: Unable to sync the ansible inventory with filters on ansible role.
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Users & Roles
Version: 6.6.0
Hardware: All
OS: Linux
high
medium
Target Milestone: Unspecified
Assignee: Ondřej Ezr
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-14 22:47 UTC by Varatharaja Perumal G
Modified: 2024-06-05 21:34 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-05 21:34:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30555 0 Normal Closed Authorizer is unable to handle association mismatch 2021-01-03 19:51:41 UTC
Red Hat Bugzilla 1569395 0 high CLOSED [Satellite 6] Adding search for lifecycle_environment or lifecycle_environment_id in role host fiter with permission vie... 2023-12-15 16:04:14 UTC
Red Hat Issue Tracker   SAT-23083 0 None Migrated None 2024-06-05 21:34:32 UTC
Red Hat Knowledge Base (Solution) 6961282 0 None None None 2022-05-31 09:38:07 UTC

Description Varatharaja Perumal G 2019-11-14 22:47:58 UTC
Description of problem:

Ansible inventory script/Ansible Tower is getting an HTTP 500 error when attempting to synchronize inventory with Red Hat Satellite 6.6.  Without filters we are able to sync the inventory without any issue.

Satellite role/Filter:-

----|---------------|------------------------------------------------------------|------------|-----------|-------|----------------
ID  | RESOURCE TYPE | SEARCH                                                     | UNLIMITED? | OVERRIDE? | ROLE  | PERMISSIONS    
----|---------------|------------------------------------------------------------|------------|-----------|-------|----------------
301 | Host          | registered_at > "200 minutes ago" and installed_at = Today | no         | no        | tower | view_hosts     
302 | Hostgroup     | none                                                       | no         | no        | tower | view_hostgroups
303 | FactValue     | none                                                       | no         | no        | tower | view_facts     
----|---------------|------------------------------------------------------------|------------|-----------|-------|----------------


Error:- 

2019-11-13T18:19:53 [W|app|838e3f9c] Action failed
2019-11-13T18:19:53 [D|app|838e3f9c] Backtrace for 'Action failed' error (ActiveRecord::ConfigurationError): Can't join 'Host::Base' to association named 'subscription_facet'; perhaps you misspelled it?
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:188:in `find_reflection'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:193:in `block in build'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `map'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `build'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:201:in `block in build'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `each'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `map'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:192:in `build'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/join_dependency.rb:72:in `initialize'


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

How reproducible:


Steps to Reproduce:
1. Create the role/filters as mentioned above.
2. Create a ansible user and associate the role.
3. Provision a new host then check whether you are able to list using ansible inventory script or tower.

Curl command is also failing with 500 error:-

# curl -k -v -u ansible:redhat  -H "Content-Type: application/json" https://satellite/api/v2/hosts/12/facts?per_page=250&page=1

Output:-

{
  "error": {"message":"Can't join 'Host::Base' to association named 'subscription_facet'; perhaps you misspelled it?"}
}


Actual results:

Getting below error:- 

error": {"message":"Can't join 'Host::Base' to association named 'subscription_facet'; perhaps you misspelled it?"}

Expected results:

We should be able to sync the inventory without any issue.

Additional info:

Comment 3 Marek Hulan 2019-11-20 15:27:06 UTC
This seems as something wrong in the database, instances of Host::Base shouldn't exist. Could you please try to verify, what does the following query return on production database?

    SELECT  "hosts".* FROM "hosts" WHERE (type = 'Host::Base') 

or if that's easier, run foreman-rake console and execute

    Host::Base.where "type = 'Host::Base'"

the upload the result here please.

Comment 10 Bryan Kearney 2020-08-04 00:04:37 UTC
Upstream bug assigned to oezr

Comment 11 Bryan Kearney 2020-08-04 00:04:39 UTC
Upstream bug assigned to oezr

Comment 12 Bryan Kearney 2020-08-25 20:04:37 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/30555 has been resolved.

Comment 13 Brad Buckingham 2020-11-13 20:18:43 UTC
Fix is in Satellite 6.9 SNAP 1 with foreman-2.3.0-0.7.rc1.el7sat.noarch

Comment 14 tstrych 2021-03-18 10:03:09 UTC
After discussion with developer we decided to put this to FailedQA.

I was able to reproduce the problem with 6.8.5 snap 1.
New role with filter on host view (with enough permissions to run ansible playbook), new user with assigned role, content host was registered by admin, Ansible playbook was ran from new user on new host. (no ansible tower was used)
Did the same steps with 6.9 snap 17.

New user no longer sees the error in 6.9, but is also unable to read facts, so the problem persist.

Comment 22 Bryan Kearney 2024-03-05 16:01:40 UTC
Upstream bug assigned to oezr

Comment 23 Eric Helms 2024-06-05 21:34:34 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


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