Actions
Bug #23859
closedTernary operation with vm_exists? in orchestration compute
Description
In app/models/concerns/orchestration/compute.rb file there is this method:
def queue_compute
return unless compute? && errors.empty?
# Create a new VM if it doesn't already exist or update an existing vm
vm_exists? ? queue_compute_create : queue_compute_update
end
When I read the ternary operator it seems to do the exact contrary of what it is explained in the comment.
And when I test it, indeed it does not create the VM in compute provider.
I think it should be:
def queue_compute
return unless compute? && errors.empty?
# Create a new VM if it doesn't already exist or update an existing vm
!vm_exists? ? queue_compute_create : queue_compute_update
end
Then it works and it finally creates the new VM in compute provider.
I am surprised that nobody else found this before.
Maybe I misunderstood something?
Actions