Class: ForemanAcd::RemoteExecutionController

Inherits:
JobInvocationsController
  • Object
show all
Defined in:
app/controllers/foreman_acd/remote_execution_controller.rb

Overview

Class to run remote execution jobs

Instance Method Summary collapse

Instance Method Details

#_routesObject



46
47
48
# File 'app/controllers/foreman_acd/remote_execution_controller.rb', line 46

def _routes
  Rails.application.routes
end

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/foreman_acd/remote_execution_controller.rb', line 19

def create
  customize_first = params[:customize] || false
  begin
    set_app_instance
    result, job = init_configuration

    unless result.success == true
      return redirect_to(app_instances_path, :error => _("Could not create remote execution job to configure the app '%{app_instance}': %{msg}") % {
        :app_instance => @app_instance, :msg => result.error
      })
    end

    @composer = job
    if customize_first == false
      @composer.trigger!
      redirect_to job_invocation_path(@composer.job_invocation)
    else
      # redirect to the job itself if we want to customize the job
      render :action => 'new'
    end
  rescue StandardError => e
    redirect_to app_instances_path, :error => _("#{job}, #{e}")
  end
end

#newObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/foreman_acd/remote_execution_controller.rb', line 6

def new
  set_app_instance
  result, job = init_configuration

  if result.success == true
    @composer = job
  else
    redirect_to(app_instances_path, :error => _("Could not create remote execution job to configure the app '%{app_instance}': %{msg}") % {
      :app_instance => @app_instance, :msg => result.error
    })
  end
end