Skip to content

Commit a71d373

Browse files
committed
fix: skip Proxmox compute orchestration for unmanaged hosts (#455)
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 a managed? guard to skip Proxmox-specific compute orchestration for unmanaged hosts. When the host is not managed, the methods return true early, allowing the registration to proceed without attempting to modify VM state on Proxmox.
1 parent f6cf842 commit a71d373

File tree

1 file changed

+6
-0
lines changed
  • app/models/concerns/orchestration/proxmox

1 file changed

+6
-0
lines changed

app/models/concerns/orchestration/proxmox/compute.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def setComputeUpdate
2626
if compute_resource.class != ForemanFogProxmox::Proxmox
2727
super
2828
else
29+
return true unless managed?
30+
2931
logger.info "Update Proxmox Compute instance for #{name}"
3032
final_compute_attributes = compute_attributes.merge(compute_resource.host_compute_attrs(self))
3133
logger.debug("setComputeUpdate: final_compute_attributes=#{final_compute_attributes}")
@@ -40,6 +42,8 @@ def delComputeUpdate
4042
if compute_resource.class != ForemanFogProxmox::Proxmox
4143
super
4244
else
45+
return true unless managed?
46+
4347
logger.info "Undo Update Proxmox Compute instance for #{name}"
4448
final_compute_attributes = old.compute_attributes.merge(compute_resource.host_compute_attrs(old))
4549
compute_resource.save_vm uuid, final_compute_attributes
@@ -97,6 +101,8 @@ def setVmDetails
97101
def setComputeDetails
98102
if compute_resource.class != ForemanFogProxmox::Proxmox
99103
super
104+
elsif !managed?
105+
true
100106
elsif vm
101107
setVmDetails
102108
else

0 commit comments

Comments
 (0)