Revision cbe40e3d
Added by Ivan Necas almost 6 years ago
app/controllers/hosts_controller.rb | ||
---|---|---|
end
|
||
|
||
def compute_resource_selected
|
||
return not_found unless (params[:host] && (id = params[:host][:compute_resource_id]))
|
||
return not_found unless params[:host]
|
||
Taxonomy.as_taxonomy @organization, @location do
|
||
compute_profile_id = params[:host][:compute_profile_id] || Hostgroup.find_by_id(params[:host][:hostgroup_id]).try(:inherited_compute_profile_id)
|
||
compute_resource = ComputeResource.authorized(:view_compute_resources).find_by_id(id)
|
||
hostgroup = Hostgroup.find_by_id(params[:host][:hostgroup_id])
|
||
compute_resource_id = params[:host][:compute_resource_id] || hostgroup.try(:inherited_compute_resource_id)
|
||
return not_found if compute_resource_id.blank?
|
||
compute_profile_id = params[:host][:compute_profile_id] || hostgroup.try(:inherited_compute_profile_id)
|
||
compute_resource = ComputeResource.authorized(:view_compute_resources).find_by_id(compute_resource_id)
|
||
render :partial => "compute", :locals => { :compute_resource => compute_resource,
|
||
:vm_attrs => compute_resource.compute_profile_attributes_for(compute_profile_id) }
|
||
end
|
||
... | ... | |
|
||
@host.set_hostgroup_defaults true
|
||
@host.set_compute_attributes unless params[:host][:compute_profile_id]
|
||
@host.apply_compute_profile(InterfaceMerge.new) if @host.compute_profile_id
|
||
set_class_variables(@host)
|
||
render :partial => "form"
|
||
end
|
Also available in: Unified diff
Refs #24072 - fix compute profile with CR set via HG
When compute resource is set via compute profile, we're not sending it
via the form (as it's disabled). Therefore, we need to search for in via
hostgroup.