Skip to content

fix(FDW): update inventory view to match current HBI schema#104

Merged
ehelms merged 1 commit into
theforeman:masterfrom
romanblanco:RHINENG-28489-fix-fdw-stale-columns
Jul 8, 2026
Merged

fix(FDW): update inventory view to match current HBI schema#104
ehelms merged 1 commit into
theforeman:masterfrom
romanblanco:RHINENG-28489-fix-fdw-stale-columns

Conversation

@romanblanco

@romanblanco romanblanco commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The inventory.hosts view references three HBI columns that have been dropped in production. Without this change, the view creation fails with "column does not exist" errors, breaking FDW imports.

  • canonical_facts: insights_id read directly as UUID column [1]
  • system_profile_facts: LEFT JOIN to system_profiles_static for operating_system, host_type, owner_id [2]
  • stale_timestamp: computed from last_check_in using HBI defaults: 29h/7d/30d [3]. Fixes pre-existing bug where stale_warning and culled were chained off stale_timestamp instead of computed independently from last_check_in.

WHERE clause updated: canonical_facts->'insights_id' IS NOT NULL replaced with insights_id != '00000000-...' (DEFAULT_INSIGHTS_ID sentinel).

Staleness intervals are hardcoded HBI defaults. Per-org overrides from hbi.staleness table are not reflected in this view.

[1] RedHatInsights/insights-host-inventory@7754a5a
[2] RedHatInsights/insights-host-inventory@62f4d24
[3] RedHatInsights/insights-host-inventory@426d5e0

The inventory.hosts view references three HBI columns that have been
dropped in production. Without this change, the view creation fails with
"column does not exist" errors, breaking FDW imports.

- canonical_facts: insights_id read directly as UUID column [1]
- system_profile_facts: LEFT JOIN to system_profiles_static for
  operating_system, host_type, owner_id [2]
- stale_timestamp: computed from last_check_in using HBI defaults:
  29h/7d/30d [3]. Fixes pre-existing bug where stale_warning and
  culled were chained off stale_timestamp instead of computed
  independently from last_check_in.

WHERE clause updated: canonical_facts->'insights_id' IS NOT NULL
replaced with insights_id != '00000000-...' (DEFAULT_INSIGHTS_ID sentinel).

Staleness intervals are hardcoded HBI defaults. Per-org overrides
from hbi.staleness table are not reflected in this view.

[1] RedHatInsights/insights-host-inventory@7754a5a
[2] RedHatInsights/insights-host-inventory@62f4d24
[3] RedHatInsights/insights-host-inventory@426d5e0

Signed-off-by: Roman Blanco <rblanco@redhat.com>
@ehelms

ehelms commented Jul 8, 2026

Copy link
Copy Markdown
Member

I assume https://github.com/theforeman/foremanctl/blob/master/src/roles/iop_inventory/tasks/main.yaml#L224 will need the same treatment?

@romanblanco

Copy link
Copy Markdown
Contributor Author

@ehelms ehelms merged commit 30eca46 into theforeman:master Jul 8, 2026
8 checks passed
@romanblanco romanblanco deleted the RHINENG-28489-fix-fdw-stale-columns branch July 9, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants