14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/foreman_katello_engine/api/environments_controller.rb', line 14
def create
begin
organization = Organization.find(params[:org_id]) if params[:org_id].present?
@environment = ForemanKatelloEngine::Environment.create!(params[:org],
params[:env],
params[:content_view],
params[:content_view_id]) do |env|
env.organizations << organization if organization
end
rescue ForemanKatelloEngine::Environment::Conflict => e
render_error 'standard_error', :status => 409, :locals => { :exception => e }
return
rescue ArgumentError => e
render_error 'standard_error', :status => 422, :locals => { :exception => e }
return
end
render :template => "api/v1/environments/show"
end
|