Skip to content

Refs #39068 - Check for persisted statuses when building global status - #10993

Merged
jeremylenz merged 1 commit into
theforeman:developfrom
synkd:sat_42220_qa_failure
Jun 9, 2026
Merged

Refs #39068 - Check for persisted statuses when building global status#10993
jeremylenz merged 1 commit into
theforeman:developfrom
synkd:sat_42220_qa_failure

Conversation

@synkd

@synkd synkd commented May 21, 2026

Copy link
Copy Markdown
Contributor

After #10962 was merged, a failure was found downstream in which a host showed a WARN status on the All Hosts page immediately after registration, although the same host showed OK for all statuses on its host details page. The cause of this appears to be that, at registration time, the host has a nil value for its execution status. When the get_status() method in app/models/host/managed.rb reads this nil status, it calls host_statuses.new() for the status. Because the host has no config reports, its status is eventually returned as status type WARN by the to_global() method in app/models/host_status/configuration_status.rb.

This PR addresses this issue by checking whether all relevant statuses are also persisted when building global status for a host.

Testing Steps:

  1. Register a host to a Foreman server with the remote execution plugin enabled.
  2. On the All Hosts page, verify that the status icon for the host is OK (green).

@synkd
synkd force-pushed the sat_42220_qa_failure branch 3 times, most recently from fbdc419 to c8b47d1 Compare May 26, 2026 19:22

@LadislavVasina1 LadislavVasina1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, automation made for this feature is passing with this patch.

@LadislavVasina1 LadislavVasina1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, dismissing my previous ACK, I accidentally checked the automation results against the incorrect branch.

@LadislavVasina1

Copy link
Copy Markdown
Contributor

Reacking, can confirm the test is passing on the correct branch.

@jeremylenz jeremylenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @synkd

The fix is working as expected. Without this change, my newly-registered host shows a WARN global status because of an "Unknown execution status," but with the PR checked out, the host global status shows OK for both All Hosts list and host details.

There is still room for improvement in one place, however - The tooltip on the All Hosts page lists status text for irrelevant statuses (Execution & Inventory in this example):

Image

Whereas host details correctly just shows "N/A" for the status text of irrelevant statuses:

image

I think it would also be worth it to fix that here.

After theforeman#10962 was merged, a failure was found downstream in which a host
showed a WARN status on the All Hosts page immediately after
registration, although the same host showed OK for all statuses on its
host details page. The cause of this appears to be that, at registration
time, the host has a nil value for its execution status. When the
`get_status()` method in `app/models/host/managed.rb` reads this nil status,
it calls `host_statuses.new()` for the status. Because the host has no
config reports, its status is eventually returned as status type `WARN` by
the `to_global()` method in `app/models/host_status/configuration_status.rb`.

This PR addresses this issue by checking whether all relevant statuses
are also persisted when building global status for a host.

Testing Steps:
1. Register a host to a Foreman server with the remote execution plugin
   enabled.
2. On the All Hosts page, verify that the status icon for the host is OK
   (green).

Assisted-by: Claude Opus 4.6
@synkd
synkd force-pushed the sat_42220_qa_failure branch from c8b47d1 to 491e1bb Compare June 8, 2026 20:39
@synkd

synkd commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

@jeremylenz I've just pushed a change that I believe addresses your most recent request. Please re-review when you have a moment.

@jeremylenz jeremylenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested again with the latest change

  1. Global status on All Hosts matches host details
  2. Number of statuses in tooltip on All Hosts matches the relevant statuses on host details

Host status seems much more sane to me now. Nice work!

ACK 👍

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.

4 participants