Module: Orchestration::Compute::InstanceMethods

Defined in:
app/models/orchestration/compute.rb

Instance Method Summary collapse

Instance Method Details

#compute?Boolean


12
13
14
# File 'app/models/orchestration/compute.rb', line 12

def compute?
  compute_resource_id.present? and compute_attributes.present?
end

#compute_objectObject


16
17
18
19
20
21
22
23
24
25
# File 'app/models/orchestration/compute.rb', line 16

def compute_object
  if uuid.present? and compute_resource_id.present?
    compute_resource.find_vm_by_uuid(uuid) rescue nil
    # we don't want the fact that we failed to fetch the information to break foreman
    # this is mostly relevant when the orchestration had a failure, and later on in the ui we try to retrieve the server again.
    # or when the server was removed not via foreman.
  elsif compute_resource_id.present? && compute_attributes
    compute_resource.new_vm compute_attributes
  end
end