Fix querying for hosts using puppet class#394
Merged
Conversation
Contributor
|
@bmagistro Thanks for the contribution, can you please fix the rubocop findings? |
6b96b4f to
80b54cd
Compare
Contributor
|
Failing tests are not related to the changes in this PR. |
ekohl
reviewed
May 30, 2024
nadjaheitmann
requested changes
Jun 18, 2024
Collaborator
nadjaheitmann
left a comment
There was a problem hiding this comment.
@bmagistro Can you please squash your commits?
Co-authored-by: Ewoud Kohl van Wijngaarden <ewoud@kohlvanwijngaarden.nl> Signed-off-by: Ben Magistro <koncept1@gmail.com>
9491b34 to
7f25cdb
Compare
|
@nadjaheitmann Sounds good, commits are now squashed. Would you merge it? |
nadjaheitmann
approved these changes
Nov 6, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When trying to query foreman for hosts that are using a particular puppet class, the query does not return the desired results. In the process of tracking this down we also encountered #386 / #387 .
Given the puppet class, it correctly lists that there are two hosts using that class.

If we follow the link we are presented with the following hosts using the class

This was tracked down to a missing sql join. We got there by raising errors and doing some explains. The queries below were ran directly to help us debug.
The above host_ids are actually host facet ids so the it tries to query these as host ids resulting in the mismatch.
Adding the below sql before running the query for hosts we get to what we expect
Using the changed code that is in the PR, and performing the same query we get the desired results
