Class: TemplateInvocationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/template_invocations_controller.rb

Instance Method Summary collapse

Instance Method Details

#controller_permissionObject



4
5
6
# File 'app/controllers/template_invocations_controller.rb', line 4

def controller_permission
  'job_invocations'
end

#showObject

Raises:

  • (ActiveRecord::RecordNotFound)


8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/template_invocations_controller.rb', line 8

def show
  @template_invocation = TemplateInvocation.find(params[:id])
  raise ActiveRecord::RecordNotFound unless User.current.can?(:view_job_invocations, @template_invocation.job_invocation)

  @template_invocation_task = @template_invocation.run_host_job_task
  @host = @template_invocation.host
  @auto_refresh = @template_invocation_task.pending?
  @since = params[:since].to_f if params[:since].present?
  @line_sets = @template_invocation_task.main_action.live_output
  @line_sets = @line_sets.drop_while { |o| o['timestamp'].to_f <= @since } if @since
  @line_counter = params[:line_counter].to_i
end