Revision c6e02bd3
Added by Joseph Magen over 10 years ago
app/models/compute_resource.rb | ||
---|---|---|
has_many_hosts
|
||
has_many :images, :dependent => :destroy
|
||
before_validation :set_attributes_hash
|
||
has_many :compute_attributes
|
||
has_many :compute_profiles, :through => :compute_attributes
|
||
# attribute used by *_names and *_name methods. default is :name
|
||
attr_name :to_label
|
||
|
||
# with proc support, default_scope can no longer be chained
|
||
# include all default scoping here
|
||
... | ... | |
ActiveSupport::HashWithIndifferentAccess.new(:name => "foreman_#{Time.now.to_i}")
|
||
end
|
||
|
||
def hardware_profiles(opts={})
|
||
def templates(opts={})
|
||
end
|
||
|
||
def hardware_profile(id,opts={})
|
||
def template(id,opts={})
|
||
end
|
||
|
||
def update_required?(old_attrs, new_attrs)
|
||
... | ... | |
self.attrs[:setpw] = setpw.to_i
|
||
end
|
||
|
||
def compute_profile_attributes_for(id)
|
||
compute_attributes.find_by_compute_profile_id(id).try(:vm_attrs) || {}
|
||
end
|
||
|
||
protected
|
||
|
||
def client
|
Also available in: Unified diff
fixes #3178 - add feature for compute profiles for hostgroups and hosts