Revision 367752a7
Added by Christine Fouant almost 10 years ago
app/controllers/katello/api/v2/systems_controller.rb | ||
---|---|---|
class Api::V2::SystemsController < Api::V2::ApiController
|
||
respond_to :json
|
||
|
||
wrap_parameters :include => (System.attribute_names + %w(type facts guest_ids host_collection_ids installed_products content_view environment))
|
||
wrap_parameters :include => (System.attribute_names + %w(type autoheal facts guest_ids host_collection_ids installed_products content_view environment))
|
||
|
||
skip_before_filter :set_default_response_format, :only => :report
|
||
|
||
... | ... | |
param :environment_id, String, :desc => N_("Specify the environment")
|
||
param :content_view_id, String, :desc => N_("Specify the content view")
|
||
def update
|
||
@system.update_attributes!(system_params(params))
|
||
|
||
system_params = system_params(params)
|
||
@system.update_attributes!(system_params)
|
||
@system.refresh_subscriptions if system_params[:autoheal]
|
||
respond_for_update
|
||
end
|
||
|
||
... | ... | |
|
||
def system_params(params)
|
||
system_params = params.require(:system).permit(:name, :description, :location, :owner, :type,
|
||
:service_level, {:facts => []},
|
||
:service_level, :autoheal, {:facts => []},
|
||
:guest_ids, {:host_collection_ids => []})
|
||
|
||
system_params[:cp_type] = params[:type] ? params[:type] : ::Katello::System::DEFAULT_CP_TYPE
|
||
system_params.delete(:type) if params[:system].key?(:type)
|
||
|
||
# TODO: permit :facts above not working, why?
|
||
system_params[:facts] = params[:facts] if params[:facts]
|
||
|
||
{ :guest_ids => :guestIds,
|
||
:installed_products => :installedProducts,
|
||
:release_ver => :releaseVer,
|
Also available in: Unified diff
fixes #6652, #6578, #6738 - Enables setting auto-attach and triggers auto-attach and shows service level, BZ 1113879, BZ 1019227, BZ 999122