Skip to content

Commit c7206dc

Browse files
sbernhardchris1984
authored andcommitted
Fix scheduled task for uploading report failed (theforeman#874)
(cherry picked from commit 210d322)
1 parent 1983a18 commit c7206dc

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

app/controllers/api/v2/rh_cloud/inventory_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def download_file
1818

1919
api :POST, "/organizations/:organization_id/rh_cloud/report", N_("Start report generation")
2020
param :organization_id, Integer, required: true, desc: N_("Set the current organization context for the request")
21-
param :disconnected, :bool, required: false, desc: N_('Generate the report, but do not upload')
21+
param :disconnected, :bool, required: false, default: false, desc: N_('Generate the report, but do not upload')
2222
def generate_report
2323
organization_id = params[:organization_id]
24-
disconnected = params[:disconnected]
24+
disconnected = params[:disconnected] || false
2525

2626
start_report_generation(organization_id, disconnected)
2727

lib/foreman_inventory_upload/async/generate_all_reports_job.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def plan
2020
total_hosts = ForemanInventoryUpload::Generators::Queries.for_org(organization.id, use_batches: false).count
2121

2222
if total_hosts <= ForemanInventoryUpload.max_org_size
23-
plan_generate_report(ForemanInventoryUpload.generated_reports_folder, organization)
23+
disconnected = false
24+
plan_generate_report(ForemanInventoryUpload.generated_reports_folder, organization, disconnected)
2425
else
2526
logger.info("Skipping automatic uploads for organization #{organization.name}, too many hosts (#{total_hosts}/#{ForemanInventoryUpload.max_org_size})")
2627
end

0 commit comments

Comments
 (0)