Project

General

Profile

0001-Add-a-cancel-build-option.patch

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

View differences:

app/controllers/hosts_controller.rb
156 156
    redirect_to :back
157 157
  end
158 158

  
159
  def cancelBuild
160
    host = Host.find params[:id]
161
    if host.built != false
162
      flash[:foreman_notice] = "Canceled pending build for #{host.name}"
163
    else
164
      flash[:foreman_error] = "Failed to cancel pending build for #{host.name}"
165
    end
166
    redirect_to :back
167
  end
168

  
159 169
  # generates a link to Puppetmaster RD graphs
160 170
  def rrdreport
161 171
    if SETTINGS[:rrd_report_url].nil? or (host=Host.find(params[:id])).last_report.nil?
app/views/hosts/show.html.erb
5 5
  <%= link_to "Facts", fact_values_path("search[host_id_eq]" => @host.id), :title => "Browse host facts" %> |
6 6
  <%= link_to "Reports", reports_host_path(@host), :title => "Browse host reports" %> |
7 7
  <%= link_to "YAML", externalNodes_host_path(@host), :title => "Puppet external nodes YAML dump" %> |
8
  <%= link_to_if @host.can_be_build?, "Build", setBuild_host_path(@host), :title => "prepare this host for build" %> |
8
  <%  if @host.can_be_build? %>  <%= link_to "Build", setBuild_host_path(@host), :title => "prepare this host for build" -%>
9
  <%  else %><%= link_to "Cancel Build", cancelBuild_host_path(@host), :title => "cancel build request for this host" %><% end %> |
9 10
  <span title="trigger a puppetrun on a node; requires that Puppet run is enabled">
10 11
    <%= link_to_if SETTINGS[:puppetrun], "Run Puppet", puppetrun_host_path(@host) %>
11 12
  </span> |
config/routes.rb
8 8
  map.resources :hosts,
9 9
                :member => { :report => :get, :reports => :get, :clone => :get,
10 10
                  :environment_selected => :post, :architecture_selected => :post, :os_selected => :post,
11
                  :storeconfig_klasses => :get, :externalNodes => :get, :setBuild => :get, :puppetrun => :get},
11
                  :storeconfig_klasses => :get, :externalNodes => :get, :setBuild => :get, :cancelBuild => :get, :puppetrun => :get},
12 12
                :collection => { :show_search => :get, :multiple_actions => :get, :multiple_parameters => :get,
13 13
                  :update_multiple_parameters => :post, :save_checkbox => :post, :select_multiple_hostgroup => :get,
14 14
                  :update_multiple_hostgroup => :post, :select_multiple_environment => :get, :update_multiple_environment => :post,
15
-