Sha256: 8c90722888433e9655ae6675a5b69472ce1e9f9d5a983d2fd6564a9e164e3fdd
Contents?: true
Size: 1.75 KB
Versions: 1
Compression:
Stored size: 1.75 KB
Contents
class JobInvocationsController < ApplicationController include Foreman::Controller::AutoCompleteSearch def new @composer = JobInvocationComposer.new.compose_from_params( :host_ids => params[:host_ids], :targeting => { :targeting_type => Targeting::STATIC_TYPE, :bookmark_id => params[:bookmark_id] }) end def rerun job_invocation = resource_base.find(params[:id]) @composer = JobInvocationComposer.new.compose_from_invocation(job_invocation) if params[:failed_only] host_ids = job_invocation.failed_host_ids @composer.search_query = @composer.targeting.build_query_from_hosts(host_ids) end render :action => 'new' end def create @composer = JobInvocationComposer.new.compose_from_params(params) action = ::Actions::RemoteExecution::RunHostsJob if @composer.save job_invocation = @composer.job_invocation if job_invocation.trigger_mode == :future ForemanTasks.delay action, job_invocation.delay_options, job_invocation else ForemanTasks.async_task(action, job_invocation) end redirect_to job_invocation_path(job_invocation) else render :action => 'new' end end def show @job_invocation = resource_base.find(params[:id]) @auto_refresh = @job_invocation.last_task.try(:pending?) end def index @job_invocations = resource_base.search_for(params[:search]).paginate(:page => params[:page]).order('id DESC') end # refreshes the form def refresh @composer = JobInvocationComposer.new.compose_from_params(params) end private def action_permission case params[:action] when 'rerun' 'create' else super end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foreman_remote_execution-0.0.7 | app/controllers/job_invocations_controller.rb |