Project

General

Custom queries

Profile

Actions

Bug #23859

closed

Ternary operation with vm_exists? in orchestration compute

Added by Tristan Robert almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Compute resources
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

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?


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #18064: Ability to import and provision existing VMsClosedTimo Goebel01/13/2017Actions
#1

Updated by Anonymous almost 7 years ago

  • Related to Feature #18064: Ability to import and provision existing VMs added
#5

Updated by The Foreman Bot almost 7 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5675 added
#7

Updated by Anonymous almost 7 years ago

  • Translation missing: en.field_release set to 353
#8

Updated by Tristan Robert almost 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
#9

Updated by Ewoud Kohl van Wijngaarden almost 7 years ago

  • Category set to Compute resources
  • Triaged set to No
Actions

Also available in: Atom PDF