Project

General

Profile

« Previous | Next » 

Revision 92b8e9b1

Added by Daniel Lobato Garcia over 10 years ago

fixes #3515 - API handles not found objects with 404

(cherry picked from commit 46338cd73c542ecc3aa045b45e831434792c710e)

View differences:

app/controllers/concerns/api/import_puppetclasses_common_controller.rb
@smart_proxy = SmartProxy.find_by_id(id.to_i) if id.to_i > 0
@smart_proxy ||= SmartProxy.find_by_name(id)
unless @smart_proxy && SmartProxy.puppet_proxies.pluck("smart_proxies.id").include?(@smart_proxy.id)
msg = 'We did not find a foreman proxy that can provide the information, ensure that this proxy has the puppet feature turned on.'
render :json => {:message => msg}, :status => :not_found and return false
not_found 'We did not find a foreman proxy that can provide the information, ensure that this proxy has the puppet feature turned on.'
end
@smart_proxy
end

Also available in: Unified diff