Module: ForemanDatacenter::HostExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/foreman_datacenter/host_extensions.rb

Instance Method Summary collapse

Instance Method Details

#fact_value_by_name(name) ⇒ Object



19
20
21
22
23
24
# File 'app/models/concerns/foreman_datacenter/host_extensions.rb', line 19

def fact_value_by_name(name)
  fact_name = FactName.find_by(name: name)
  if fact_name
    fact_values.find_by(fact_name: fact_name)
  end
end

#update_device_on_destroyObject



11
12
13
14
15
16
17
# File 'app/models/concerns/foreman_datacenter/host_extensions.rb', line 11

def update_device_on_destroy
  if device
    new_device_name = "Unassigned device (former: #{name})"
    device.update(name: new_device_name)
    # device.interfaces.clear
  end
end