Project

General

Profile

Feature #323 » 0001-Add-a-cancel-build-option.patch

Frank Sweetser, 06/14/2010 07:28 PM

View differences:

app/controllers/hosts_controller.rb
redirect_to :back
end
def cancelBuild
host = Host.find params[:id]
if host.built != false
flash[:foreman_notice] = "Canceled pending build for #{host.name}"
else
flash[:foreman_error] = "Failed to cancel pending build for #{host.name}"
end
redirect_to :back
end
# generates a link to Puppetmaster RD graphs
def rrdreport
if SETTINGS[:rrd_report_url].nil? or (host=Host.find(params[:id])).last_report.nil?
app/views/hosts/show.html.erb
<%= link_to "Facts", fact_values_path("search[host_id_eq]" => @host.id), :title => "Browse host facts" %> |
<%= link_to "Reports", reports_host_path(@host), :title => "Browse host reports" %> |
<%= link_to "YAML", externalNodes_host_path(@host), :title => "Puppet external nodes YAML dump" %> |
<%= link_to_if @host.can_be_build?, "Build", setBuild_host_path(@host), :title => "prepare this host for build" %> |
<% if @host.can_be_build? %> <%= link_to "Build", setBuild_host_path(@host), :title => "prepare this host for build" -%>
<% else %><%= link_to "Cancel Build", cancelBuild_host_path(@host), :title => "cancel build request for this host" %><% end %> |
<span title="trigger a puppetrun on a node; requires that Puppet run is enabled">
<%= link_to_if SETTINGS[:puppetrun], "Run Puppet", puppetrun_host_path(@host) %>
</span> |
config/routes.rb
map.resources :hosts,
:member => { :report => :get, :reports => :get, :clone => :get,
:environment_selected => :post, :architecture_selected => :post, :os_selected => :post,
:storeconfig_klasses => :get, :externalNodes => :get, :setBuild => :get, :puppetrun => :get},
:storeconfig_klasses => :get, :externalNodes => :get, :setBuild => :get, :cancelBuild => :get, :puppetrun => :get},
:collection => { :show_search => :get, :multiple_actions => :get, :multiple_parameters => :get,
:update_multiple_parameters => :post, :save_checkbox => :post, :select_multiple_hostgroup => :get,
:update_multiple_hostgroup => :post, :select_multiple_environment => :get, :update_multiple_environment => :post,
(1-1/2)