Class: ForemanInventoryUpload::Async::GenerateReportJob

Inherits:
ShellProcess
  • Object
show all
Defined in:
lib/foreman_inventory_upload/async/generate_report_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ShellProcess

#logger, #progress_output, #rescue_strategy_for_self, #try_execute

Methods included from ForemanRhCloud::Async::ExponentialBackoff

#attempts_before_next_interval, #done!, #done?, #invoke_external_task, #poll_external_task, #poll_intervals, #try_execute

Methods included from AsyncHelpers

#hash_to_s

Class Method Details

.output_label(label) ⇒ Object



4
5
6
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 4

def self.output_label(label)
  "report_for_#{label}"
end

Instance Method Details

#base_folderObject



41
42
43
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 41

def base_folder
  input[:base_folder]
end

#commandObject



30
31
32
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 30

def command
  "#{rake_prefix}rake rh_cloud_inventory:report:generate"
end

#envObject



34
35
36
37
38
39
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 34

def env
  super.merge(
    'target' => base_folder,
    'organization_id' => organization_id
  )
end

#organization_idObject



45
46
47
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 45

def organization_id
  input[:organization_id]
end

#plan(base_folder, organization_id, disconnected) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 8

def plan(base_folder, organization_id, disconnected)
  sequence do
    super(
      GenerateReportJob.output_label(organization_id),
      organization_id: organization_id,
      base_folder: base_folder
    )

    plan_action(
      QueueForUploadJob,
      base_folder,
      ForemanInventoryUpload.facts_archive_name(organization_id),
      organization_id,
      disconnected
    )
  end
end

#rake_prefixObject



26
27
28
# File 'lib/foreman_inventory_upload/async/generate_report_job.rb', line 26

def rake_prefix
  'foreman-' unless Rails.env.development?
end