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



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

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
# File 'app/models/concerns/foreman_datacenter/host_extensions.rb', line 11

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