Class: ForemanInventoryUpload::Async::HostInventoryReportJob
- Inherits:
-
Actions::EntryAction
- Object
- Actions::EntryAction
- ForemanInventoryUpload::Async::HostInventoryReportJob
- Defined in:
- lib/foreman_inventory_upload/async/host_inventory_report_job.rb
Direct Known Subclasses
Instance Method Summary collapse
- #humanized_name ⇒ Object
- #organization ⇒ Object
- #organization_id ⇒ Object
- #plan(base_folder, organization_id, hosts_filter = "", upload = true) ⇒ Object
- #report_file_path ⇒ Object
- #rescue_strategy_for_self ⇒ Object
- #resource_locks ⇒ Object
Instance Method Details
#humanized_name ⇒ Object
44 45 46 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 44 def humanized_name _("Host inventory report job") end |
#organization ⇒ Object
48 49 50 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 48 def organization Organization.find(input[:organization_id]) end |
#organization_id ⇒ Object
52 53 54 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 52 def organization_id input[:organization_id] end |
#plan(base_folder, organization_id, hosts_filter = "", upload = true) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 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 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 8 def plan(base_folder, organization_id, hosts_filter = "", upload = true) organization = Organization.find(organization_id) action_subject(organization) plan_self( base_folder: base_folder, organization_id: organization_id, hosts_filter: hosts_filter, upload: upload ) sequence do plan_action( GenerateHostReport, base_folder, organization_id, hosts_filter ) if upload plan_action( QueueForUploadJob, base_folder, ForemanInventoryUpload.facts_archive_name(organization_id, hosts_filter), organization_id ) end if ForemanRhCloud.with_iop_smart_proxy? plan_action( CreateMissingInsightsFacets, organization_id ) end end end |
#report_file_path ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 56 def report_file_path filename = ForemanInventoryUpload.facts_archive_name(input[:organization_id], input[:hosts_filter]) if input[:upload] # For upload tasks, check: done folder (uploaded), uploads folder (queued), generated_reports folder (failed upload) [ ForemanInventoryUpload.done_file_path(filename), ForemanInventoryUpload.uploads_file_path(filename), File.join(input[:base_folder], filename), ].find { |path| File.exist?(path) } else # For generate-only tasks, only check generated_reports folder generated_path = File.join(input[:base_folder], filename) File.exist?(generated_path) ? generated_path : nil end end |
#rescue_strategy_for_self ⇒ Object
73 74 75 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 73 def rescue_strategy_for_self Dynflow::Action::Rescue::Fail end |
#resource_locks ⇒ Object
4 5 6 |
# File 'lib/foreman_inventory_upload/async/host_inventory_report_job.rb', line 4 def resource_locks :link end |