Class: ForemanDatacenter::Manufacturer

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/foreman_datacenter/manufacturer.rb

Class Method Summary collapse

Class Method Details

.for_host(host) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'app/models/foreman_datacenter/manufacturer.rb', line 7

def self.for_host(host)
  fact = host.fact_value_by_name('manufacturer')
  if fact
    manufacturer = find_by(name: fact.value)
    if manufacturer
      manufacturer
    else
      create(name: fact.value)
    end
  end
end