Skip to content

Fixes #39299 - Add additive fact import mode#10980

Open
pablomh wants to merge 2 commits into
theforeman:developfrom
pablomh:registration/additive-fact-import
Open

Fixes #39299 - Add additive fact import mode#10980
pablomh wants to merge 2 commits into
theforeman:developfrom
pablomh:registration/additive-fact-import

Conversation

@pablomh

@pablomh pablomh commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Add additive: keyword argument to FactImporter#import! and HostFactImporter#import_facts. When true, existing facts not in the new set are preserved (delete_removed_facts is skipped).

This enables importing a subset of facts without wiping facts from other sources, needed by Katello (katello#11701) to import only OS-detection facts at registration time.

Changes

  • fact_importer.rb: import!(additive: false) — skips delete_removed_facts when true
  • host_fact_importer.rb: import_facts(facts, source_proxy = nil, additive: false) — passes through
  • Test: verifies additive import preserves existing facts
  • Test brace fixes for Ruby keyword argument disambiguation

How to test

  1. bundle exec rake test TEST=test/unit/fact_importer_test.rb
  2. bundle exec rake test TEST=test/unit/host_fact_importer_test.rb

pablomh and others added 2 commits June 3, 2026 10:03
Simplify the persisted-host fact insert path by carrying new facts as a
hash, using association-scoped bulk insert timestamp handling, and covering
host/timestamp behavior for both flat and structured fact imports.

Co-authored-by: Cursor <cursoragent@cursor.com>
Add additive mode to fact imports so partial uploads preserve existing facts, and cover the HostFactImporter service path with forwarding tests for additive mode and source proxy handling.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pablomh pablomh force-pushed the registration/additive-fact-import branch from e5c2493 to 6f1c6fa Compare June 3, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant