WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@ShimShtein
Copy link
Member

Make sure the fact parser searches by all unique constraint combinations before creating a new object.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to do a review, but this caught my eye. So take my comments here as suggestions.

Looking at the failed tests I think we're using assert_equal in the wrong order, leading to confusing errors. Not a blocker.

But the failing tests do look related so please have a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have FacterDB as a dependency which contains these kinds of fact sets. Is it possible to reuse that? I see others use static files so don't consider this blocking.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there is a warning under the hood of FacterDB:

./home/vagrant/foreman/.vendor/ruby/3.0.0/gems/jgrep-1.5.4/lib/jgrep.rb:27: warning: detected duplicate key "osfamily" in JSON object. This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true` at line 86377 column 2
/home/vagrant/foreman/.vendor/ruby/3.0.0/gems/jgrep-1.5.4/lib/jgrep.rb:27: warning: detected duplicate key "fqdn" in JSON object. This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true` at line 197772 column 2
/home/vagrant/foreman/.vendor/ruby/3.0.0/gems/jgrep-1.5.4/lib/jgrep.rb:27: warning: detected duplicate key "hostname" in JSON object. This will raise an error in json 3.0 unless enabled via `allow_duplicate_key: true` at line 402388 column 2

It is not problematic yet, but I preferred not to mess with external dependency.

@ShimShtein ShimShtein force-pushed the fix_operatingsystem_deduplication branch from 5a2c434 to 65dacac Compare December 3, 2025 16:52
@github-actions github-actions bot added the UI label Dec 3, 2025
@ShimShtein ShimShtein force-pushed the fix_operatingsystem_deduplication branch from 65dacac to 8fa0cfa Compare December 3, 2025 17:14
@ShimShtein
Copy link
Member Author

Fixed the original errors that @ekohl was referring to. The new errors seem trickier, since they do not appear in my local environment.

@ShimShtein
Copy link
Member Author

[test]

@ShimShtein ShimShtein force-pushed the fix_operatingsystem_deduplication branch 3 times, most recently from bf74f09 to 1f1517b Compare December 7, 2025 14:45
@ShimShtein
Copy link
Member Author

Found out that the errors came from newer gem version in the CI. Updated the gem versions locally and the errors appeared for me too.
The errors were related to problems parsing fact files in the facterdb gem. Some of those files contain invalid json.

I have fixed the issue by forcing facterdb to load only the files that are relevant to the checks we perform. Luckily those files were OK, and the tests could run successfully.

Make sure the fact parser searches by all unique constraint combinations before creating a new object.
@ShimShtein ShimShtein force-pushed the fix_operatingsystem_deduplication branch from 1f1517b to 99ebc5c Compare December 7, 2025 15:05
@ekohl
Copy link
Member

ekohl commented Dec 7, 2025

Did you file an issue for the broken files?

@ShimShtein
Copy link
Member Author

Did you file an issue for the broken files?

We're using an antique version of facterdb gem. In the newer versions of the gem we don't have older facter versions of the data, so I didn't test our code against the newer facterdb. If we want to file a ticket, it would not make sense to file it against v1.27 when v4.0 is already out.

@stejskalleos stejskalleos self-requested a review December 9, 2025 12:43
@stejskalleos stejskalleos self-assigned this Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants