Fixes - Skip compute orchestration for unmanaged hosts#456
Open
jakduch wants to merge 1 commit intotheforeman:masterfrom
Open
Fixes - Skip compute orchestration for unmanaged hosts#456jakduch wants to merge 1 commit intotheforeman:masterfrom
jakduch wants to merge 1 commit intotheforeman:masterfrom
Conversation
Author
|
PS. Tested and worked on our production servers. |
9af5ca3 to
a71d373
Compare
Author
Additional finding: core Foreman also needs
|
Contributor
|
@jakduch Can you please add a log message and some test coverage analogue to the PR in Foreman core? (theforeman/foreman#10905) |
a71d373 to
2e21c8d
Compare
…ed hosts When a host is registered via Global Registration with a hostgroup that has a Compute Resource (Proxmox), the compute orchestration methods (setComputeUpdate, delComputeUpdate, setComputeDetails) are triggered even though the host is unmanaged (managed: false). This causes errors like "protected method setCompute called" because the orchestration tries to interact with the Proxmox API for a host that was not provisioned through Foreman. This patch adds managed? guards with log messages to skip Proxmox-specific compute orchestration for unmanaged hosts, analogous to foreman core PR #10905. Unit tests verify all three methods skip orchestration and log appropriately for unmanaged hosts. Assisted-By: Claude (Anthropic)
2e21c8d to
b30393f
Compare
Author
|
Added log messages and unit tests as requested, following the same pattern as foreman#10905. Changes:
Squashed into a single commit with |
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.
Summary
When registering existing hosts via Foreman Global Registration using a hostgroup
that includes a Proxmox Compute Resource, the plugin's compute orchestration
methods (
setComputeUpdate,delComputeUpdate,setComputeDetails) are triggeredeven though the host is unmanaged (
managed: false).This causes errors such as:
The root cause is that core Foreman's
queue_computeruns whenevercompute_resource_idis present (inherited from the hostgroup), but the plugin's orchestration overrides
do not check whether the host is actually managed before attempting Proxmox API operations.
Changes
Added
managed?guards to the three orchestration methods inapp/models/concerns/orchestration/proxmox/compute.rb:setComputeUpdate: returnstrueearly if host is not manageddelComputeUpdate: returnstrueearly if host is not managedsetComputeDetails: returnstrueearly if host is not managedImpact
managed: trueand orchestration runs normallymanaged: truelogicEnvironment
Test plan