Project

General

Profile

« Previous | Next » 

Revision b6e0cb16

Added by Ohad Levy over 13 years ago

fixes #454 - Foreman render 500 instead of 404

  • Fixes the not found method
  • generalize the find_by_obj_name method so we DRY abit more

View differences:

app/controllers/hosts_controller.rb
before_filter :find_multiple, :only => [:multiple_actions, :update_multiple_parameters,
:select_multiple_hostgroup, :select_multiple_environment, :multiple_parameters, :multiple_destroy,
:multiple_enable, :multiple_disable, :submit_multiple_disable, :submit_multiple_enable]
before_filter :find_host, :only => %w[show edit update destroy puppetrun setBuild cancelBuild report
before_filter :find_by_name, :only => %w[show edit update destroy puppetrun setBuild cancelBuild report
reports facts storeconfig_klasses clone externalNodes pxe_config]
filter_parameter_logging :root_pass
......
end
rescue
# failed
logger.warn "Failed to generate external nodes for #{@host.name} with #{$!}"
logger.warn "Failed to generate external nodes for #{@host} with #{$!}"
render :text => 'Unable to generate output, Check log files\n', :status => 412 and return
end
end
......
redirect_to(hosts_path) and return
end
def find_host
if params[:id]
render not_found unless @host = Host.find_by_name(params[:id])
end
end
# Returns the associationes to include when doing a search.
# If the user has a fact_filter then we need to include :fact_values
# We do not include most associations unless we are processing a html page

Also available in: Unified diff